Upgrade MaybeT to AMP, and otherwise clean it up

David Feuer david.feuer at gmail.com
Sat Jan 3 20:31:29 UTC 2015


http://stackoverflow.com/questions/22750315/applicative-instance-for-maybet-m-assumes-monad-m
noted that

instance (Functor m, Monad m) => Applicative (MaybeT m)
instance (Functor m, Monad m) => Alternative (MaybeT m)

is not exactly ideal. An answer to the question explained why MaybeT isn't
really so important for Applicative, but that doesn't seem to be a good
reason to leave the status quo in place. If I'm not very much mistaken,
there are two issues:

1. The Functor constraint is never used, and of course every valid monad is
also a valid functor with fmap=liftM. So for pre-AMP base, the signatures
should have had only a Monad constraint, and not a Functor one.

2. For AMP, the constraints should be changed to require Applicative
instead of Monad.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20150103/6e275e0a/attachment.html>


More information about the Libraries mailing list