[Haskell-cafe] Re: what is inverse of mzero and return?
Jorge Adriano Aires
jadrian at mat.uc.pt
Sun Jan 23 12:55:44 EST 2005
> I think it would be helpful if all these classes came with their laws
> prominently attached in their Haddock documentation or wherever.
Agree.
> The trouble with MonadPlus is that the precise set of associated laws is
> either unspecified or not the most useful (I assume there's a paper on
> the class somewhere). I think everyone can agree on these:
>
> mplus mzero a = a
> mplus a mzero = a
> mplus (mplus a b) c = mplus a (mplus b c)
<snip>
> (mplus a b) >>= c = mplus (a >>= c) (b >>= c)
I just checked the paper,
"A monadic Interpretation of Tatics", by Andrew Martin and Jeremy Gibbons
http://web.comlab.ox.ac.uk/oucl/work/jeremy.gibbons/publications/tactics.pdf
And in deed, these are the listed laws for MonadPlus. On the other hand, Maybe
is said to be an instance of MonadPlus.
So now I'm lost.
Cheers,
J.A.
More information about the Haskell-Cafe
mailing list