[Haskell-cafe] On to applicative

michael rice nowgate at yahoo.com
Thu Aug 26 01:56:23 EDT 2010


From: http://en.wikibooks.org/wiki/Haskell/Applicative_Functors

=============================
import Control.Applicative

f :: (a -> b -> c)
fmap :: Functor f => (d -> e) -> f d -> f e
fmap f :: Functor f => f a -> f (b -> c)    -- Identify d with a, and e with (b -> c)

sumsqr :: Int -> Int -> Int    -- my f
sumsqr i j = i*i+j*j
=============================

I'm trying to understand how the above works but... 

[michael at localhost ~]$ ghci
GHCi, version 6.12.1: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package ffi-1.0 ... linking ... done.
Prelude> :l bozo.hs
[1 of 1] Compiling Main             ( bozo.hs, interpreted )

bozo.hs:5:0: Invalid type signature
Failed, modules loaded: none.
Prelude> 


Michael




      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100826/fbcfff0c/attachment.html


More information about the Haskell-Cafe mailing list