
2 Mar
2011
2 Mar
'11
2:03 p.m.
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 map::(a->b)->[a]->[b] if [] is substituted for f in the class definition of Functor the following is obtained class Functor [] where fmap::(a->b)->[]a->[]b 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: fmap::(a->b)->[a]->[b] which is the same as map type and therefore: fmap = map. QED. Can you please answer questions 2 and 3 above? Thank you