Studying Wadler's "Comprehending Monads" and "Theorems for free!",
I've been unable to derive law (iv) and I'm not sure about (iii). Will
appreciate a pointer to similar examples or a massive hint. Here's my
attempt at (iii):
map f . unit x = map f [x]
= [f x]
= unit (f x)
= (unit . f) x
map f . unit = unit .f
>From the Monads article:
unit :: x -> M x
join :: M (M x) -> M x
For example, unit 3 = [3] and join [[1,2], [3]] = [1,2,3]
(iii) map f . unit = unit . f
(iv) map f . join = join . map (map f)
Laws (iii) and (iv) may be derived by systematic transformations of
the polymorphic types of unit and join.
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe