Hi,

Suppose you have something like:

data Tree a = Leaf a | Branch (Tree a) (Tree a)

instance Functor Tree where

fmap f (Leaf a) = Leaf $ f a

fmap f (Branch l r) = Branch (fmap f l) (fmap f r)

To check that fmap id = id, I can see that the case for Leaf is ok:

fmap id (Leaf a) = Leaf $ id a = Leaf a

Thanks,

toz

_______________________________________________

Beginners mailing list

[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners