2010/8/26 michael rice <nowg...@yahoo.com> > > 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... > > [mich...@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>
Hi, The fifth line has the form x y :: ... instead of x :: ... This is not a legal type signature. Furthermore, you can't give fmap two signatures in the same source file. The reason this is given on the page you linked is for demonstration purpose (well, I guess, I haven't read it). Cheers, Thu _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe