Cont as Monoid

Conal Elliott conal at conal.net
Sun Sep 9 14:02:58 EDT 2007


> "Cont (Endo b) a" is the usual backtracking monad.

It is?  Would you say more about that?  A pointer would be fine.  I'm
wondering what the role of Endo is here.

Cheers,  - Conal

On 9/9/07, David Menendez <zednenem at psualum.com> wrote:
>
> On 9/8/07, Conal Elliott <conal at conal.net> wrote:
> > I'd like to see the following addition to Control.Monad.Cont in mtl:
> >
> > instance Monoid r => Monoid (Cont r a) where
> >     mempty         = Cont mempty
> >     m `mappend` m' = Cont (runCont m `mappend` runCont m')
>
> Alternatively,
>
>     instance Monoid r => MonadPlus (Cont r a) where
>         mzero = Cont mempty
>         mplus a b = Cont $ runCont a `mappend` runCont b
>
> "Cont (Endo b) a" is the usual backtracking monad.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/libraries/attachments/20070909/293421e7/attachment-0001.htm


More information about the Libraries mailing list