[Haskell-cafe] A question about "monad laws"
stefanor at cox.net
Mon Feb 11 16:34:54 EST 2008
On Mon, Feb 11, 2008 at 01:59:09PM +0000, Neil Mitchell wrote:
> > > (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:
My favorite presentation of the monad laws is associativity of Kliesli
(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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: Digital signature
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20080211/c7e25e76/attachment.bin
More information about the Haskell-Cafe