On Mon, Feb 11, 2008 at 01:59:09PM +0000, Neil Mitchell wrote:
> Hi
> 
> > > (x >>= f) >>= g == x >>= (\v -> f v >>= g)
> >
> > Or stated another way:
> >
> > (x >>= f) >>= g == x >>= (f >>= g)
> 
> Which is totally wrong, woops.
> 
> See this page for lots of details about the Monad Laws and quite a
> nice explanation of where you use them:
> http://www.haskell.org/haskellwiki/Monad_Laws

My favorite presentation of the monad laws is associativity of Kliesli
composition:

(a1 >=> a2) x = a1 x >>= a2   -- predefined in 6.8 control.monad

-- The laws

return >=> a    = a
a >=> return    = a
a >=> (b >=> c) = (a >=> b) >=> c

Stefan

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to