[Haskell-cafe] About mplus

ok ok at cs.otago.ac.nz
Tue Sep 4 23:35:03 EDT 2007


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

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

I also wondered why, once MonadPlus was added to the language, the
definition of ++ wasn't changed to
	(++) = MonadPlus
(with the MonadPlus instance for [] defined directly).

Aside from getting msum and guard, is there any point in bothering to
make something an instance of MonadPlus?



More information about the Haskell-Cafe mailing list