MonadPlus instance for ContT

Edward Kmett ekmett at gmail.com
Mon Jun 24 21:26:26 CEST 2013


Because there are many monads for which you do not want this construction!

It isn't what you mean when you use mappend on [a] for sure! It is also
different from the behavior for Monad, and it rules out those and many many
other perfectly valid uses by overlap.

-Edward

On Mon, Jun 24, 2013 at 3:20 PM, John Wiegley <johnw at fpcomplete.com> wrote:

> >>>>> Edward Kmett <ekmett at gmail.com> writes:
>
> > The third construction is the 'universal' lifting that works for every
> > Applicative, which would look like:
>
> > instance (Monad m, Monoid a) => Monoid (ContT r m a) where
> >   mempty = return mempty
> >   mappend = liftM2 mappend
>
> Why not then this?  That is, once AMP is out...
>
>     instance (Applicative m, Monoid a) => Monoid (m a) where
>         mempty  = pure mempty
>         mappend = liftA2 mappend
>
> --
> John Wiegley
> FP Complete                         Haskell tools, training and consulting
> http://fpcomplete.com               johnw on #haskell/irc.freenode.net
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20130624/4c8241d0/attachment.htm>


More information about the Libraries mailing list