The Haskell 1.4 Report states that instances of MonadZero and
MonadPlus should satisfy these laws:

    m >> zero   =  zero
    zero >>= m  =  zero

    m ++ zero = m
    zero ++ m = m

Now that MonadPlus has been moved out of the Prelude (and has changed
the names of all its operators), I see that no mention of these laws
is in section 10.2 of the Haskell 98 Library Report.  I assume this is
inadvertent and that instances of MonadPlus should still satisfy these
laws.

But I have a question: Would it be reasonable to expect any instance
of MonadPlus to satisfy the following law (using `mplus', not ++ now)?

  m >>= (\x->f x `mplus` g x)  
              =  
  (m >>= f) `mplus` (m >>= g)

It is true for the Maybe and list instances.

Can anyone give me a reasonable instance of MonadPlus which wouldn't
satisfy this but does satisfy the above four laws?  Or, is there some
deep reason why this "should" be true?

Thanks.

- Mark

Reply via email to