[Haskell-cafe] Monad laws

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Fri Sep 8 07:06:12 EDT 2006


On Fri, 2006-09-08 at 01:43 -0400, Albert Lai wrote:
> Deokhwan Kim <dk at ropas.snu.ac.kr> 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



More information about the Haskell-Cafe mailing list