
8 Sep
2006
8 Sep
'06
7:06 a.m.
On Fri, 2006-09-08 at 01:43 -0400, Albert Lai wrote:
Deokhwan Kim
writes: What is the practical meaning of monad laws?
1. (return x) >>= f == f x 2. m >>= return == m 3. (m >>= f) >>= g == m >> (\x -> f x >>= g)
I offer to re-write the laws in do-notation. (Please view with a fixed-width (non-proportional) font.)
I think this is an excellent explanation and quite intuitive for beginners. I've turned your post into a wiki page here: http://haskell.org/haskellwiki/Monad_Laws I hope that's ok with you (I'll remove it if it's not ok). Feel free to edit it. Duncan