[Haskell-cafe] Re: what is inverse of mzero and return?
Keean Schupke
k.schupke at imperial.ac.uk
Sun Jan 23 05:39:24 EST 2005
Aaron Denney wrote:
>You can, but the "other one" turns it into a copy of the Maybe Monad, so
>the current one is more useful.
>
>
So what does this mean in terms of Ashley's question:
But only some instances (such as []) satisfy this:
(mplus a b) >>= c = mplus (a >>= c) (b >>= c)
Other instances (IO, Maybe) satisfy this:
mplus (return a) b = return a
Does it mean that both fall within the acceptable definition of the monad laws
for MonadPlus?
1. |mzero >>= f == mzero|
2. |m >>= (\x -> mzero) == mzero|
3. |mzero `mplus` m == m|
4. |m `mplus` mzero == m|
So I guess I must have missed the point because the distinction between say a monad on
[] and Maybe for example seems to me to be irrelevant to MonadPlus. The distinction comes
down to mplus being the same as skipError for Maybe and different for [].
Keean.
More information about the Haskell-Cafe
mailing list