MonadPlus Reform

Cale Gibbard cgibbard at gmail.com
Wed Mar 22 14:00:41 EST 2006


I'd like to put a "me too" on that one. This part of the class
hierarchy is currently a bit inexpressive. I've been annoyed by the
fact that if I want to express in the type signature of a function
that a monad has a failure mechanism, I'm forced to go all the way up
to MonadPlus, which makes it look like something fully
nondeterministic is happening, when really I'm just possibly failing.

Also, mplus and morelse are quite different things, and it would be
nice to have both even in a monad supporting mplus. For instance, in
the list monad,
mplus = (++)
but
morelse [] ys = ys
morelse (x:xs) ys = (x:xs)

 - Cale

On 21/03/06, Ashley Yakeley <ashley at semantic.org> wrote:
> Does this come under the "standard libraries" topic? I would like to see
> the MonadPlus class disambiguated:
>
> class Monad m => MonadZero m where
>     mzero :: m a
> class MonadZero m => MonadPlus m where
>     mplus :: m a -> m a -> m a
> class MonadZero m => MonadOr m where
>     morelse :: m a -> m a -> m a
>
> <http://haskell.org/haskellwiki/MonadPlus_reform_proposal>
>
> --
> Ashley Yakeley, Seattle WA
> WWED? http://www.cs.utexas.edu/users/EWD/
>
> _______________________________________________
> Haskell-prime mailing list
> Haskell-prime at haskell.org
> http://haskell.org/mailman/listinfo/haskell-prime
>


More information about the Haskell-prime mailing list