On 26 Jan 2005, at 05:57, David Menendez wrote:
Philip Wadler listed those as the laws he "would usually insist on" in a
1997 message[1].


    [1] <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
lists.


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 broken.

Are there any interesting programming uses of MonadPlus apart from 'calculations returning multiple values'.. i.e. lists/sets/multisets/maybe?

Jules

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to