[Haskell-cafe] Re: What are the MonadPlus laws?
jules at jellybean.co.uk
Wed Jan 26 05:56:40 EST 2005
On 26 Jan 2005, at 05:57, David Menendez wrote:
> Philip Wadler listed those as the laws he "would usually insist on" in
> 1997 message.
>  <http://www.dcs.gla.ac.uk/mail-www/haskell/msg00057.html>
> He also mentions two other possible, but problematic, laws:
> m >>= \x -> mzero == mzero
> m >>= \x -> k x `mplus` h x == m >>= k `mplus` m >>= h
> The first doesn't hold when m is bottom. The second doesn't hold for
Well I think the issue with bottom is not too upsetting.
The second holds 'up to reordering of the elements', I think?. If you
consider lists as representing non-deterministic or multiple-valued
computation, then it is quite natural to feel comfortable ignoring the
ordering. (In effect, using lists as a model for multi-sets, which form
a commutative monad?)
But it certainly looks like the IO instance for MonadPlus is badly
Are there any interesting programming uses of MonadPlus apart from
'calculations returning multiple values'.. i.e.
More information about the Haskell-Cafe