[Haskell-cafe] A question about "monad laws"

Deokjae Lee asitdepends2 at gmail.com
Mon Feb 11 08:33:23 EST 2008


Tutorials about monad mention the "monad axioms" or "monad laws". The
tutorial "All About Monads" says that "It is up to the programmer to
ensure that any Monad instance he creates satisfies the monad laws".

The following is one of the laws.

(x >>= f) >>= g == x >>= (\v -> f v >>= g)

However, this seems to me a kind of mathematical identity. If it is
mathematical identity, a programmer need not care about this law to
implement a monad. Can anyone give me an example implementation of
monad that violate this law ?


More information about the Haskell-Cafe mailing list