[Haskell-cafe] Re: what is inverse of mzero and return?
Marcin 'Qrczak' Kowalczyk
qrczak at knm.org.pl
Sun Jan 23 08:22:36 EST 2005
Ashley Yakeley <ashley at semantic.org> writes:
> 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
>
> I think mplus should be separated into two functions.
This would prevent using mplus in a single parser which - depending on
the underlying monad used - backtracks or not.
--
__("< Marcin Kowalczyk
\__/ qrczak at knm.org.pl
^^ http://qrnik.knm.org.pl/~qrczak/
More information about the Haskell-Cafe
mailing list