MonadPlus instance for ContT

Wolfgang Jeltsch g9ks157k at acme.softbase.org
Tue Jan 6 10:33:40 EST 2009


Hello,

I wonder why there isn’t a MonadPlus instance for ContT. In my opinion, this 
one would be natural:

> instance (MonadPlus monad) => MonadPlus (ContT result monad) where
>
>     mzero = ContT $ return mzero
>
>     ContT cont1 `mplus` ContT cont2 = ContT $ liftM2 mplus cont1 cont2

return and liftM2 are the ones of (->) (o -> monad result).

What do you think?

Best wishes,
Wolfgang


More information about the Libraries mailing list