[Haskell-cafe] About mplus

ajb at spamcop.net ajb at spamcop.net
Wed Sep 5 23:49:44 EDT 2007

G'day all.

Slight nit...

Quoting ok <ok at cs.otago.ac.nz>:

> I've been thinking about making a data type an instance of MonadPlus.
> From the Haddock documentation at haskell.org, I see that any such
> instance should satisfy
> 	mzero `mplus` x = x
> 	x `mplus` mzero = x
> 	mzero >>= f     = mzero
> 	v >> mzero      = mzero

As discussed previously, that last "law" is wrong.  In particular, it
can't be true of any monad transformer:

     lift fireMissiles >> mzero /= mzero

> but is that all there is to it?  Are there no other requirements for
> MonadPlus to make sense?

It's proposed to split nondeterminism-like monads and error catch-like
monads to allow for some other laws:


Andrew Bromage

More information about the Haskell-Cafe mailing list