[Haskell-cafe] About mplus

Stefan O'Rear stefanor at cox.net
Tue Sep 4 23:42:43 EDT 2007

On Wed, Sep 05, 2007 at 03:35:03PM +1200, ok wrote:
> 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).

It was.  They changed it back in Haskell 98, as part of a grand program
of dumbing down the langauge...  Cale Gibbard says {{{I get the impression
there were a lot of people on the Haskell 98 committee who really really
hated polymorphism.}}}.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20070904/200cb4a8/attachment.bin

More information about the Haskell-Cafe mailing list