[Haskell-beginners] Monads

Patrick Lynch kmandpjlynch at verizon.net
Wed Mar 2 15:03:00 CET 2011

In Learn You a Haskell for Great Good!, the author Miran Lipovaca indicates that to understand Monads you need to know Functors...
So, I noticed the following:

class Functor f where
  fmap::(a->b)->f a->f b

instance Functor [] where
  fmap = map


if [] is substituted for f in the class definition of Functor the following is obtained
class Functor [] where

my questions are:
  1. is this substitution ok?
  2. is []a = [a]?
  3. is []b = [b]?

if 2. and 3. are valid then the following is obtained:
which is the same as map type and therefore: fmap = map. QED.

Can you please answer questions 2 and 3 above?

Thank you

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20110302/6d9df3f8/attachment.htm>

More information about the Beginners mailing list