Deriving laws by systematic transformations

31 Aug
2011
31 Aug
'11
2:14 p.m.
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.
5012
Age (days ago)
5012
Last active (days ago)
0 comments
1 participants
participants (1)
-
Armando Blancas