Proposal: add "writer" Monad instance (,) o (Ticket #1951)

Conal Elliott conal at conal.net
Mon Dec 3 13:50:50 EST 2007


Hi Chris.  I don't think that version could type-check.  Try it out.  -
Conal

On Dec 3, 2007 8:52 AM, Chris Kuklewicz <chrisk at mightyreason.com> wrote:

> In State, the tuple order that is use is
> > newtype State s a = State {
> > runState :: (s -> (a, s))
> > }
>
> So I would expect you to use the same order for writer.   This only
> changes (>>)
> below:
>
> > instance Monoid o => Monad ((,) o) where
> >     return = (a,mempty)
> >     (a,o) >>= f = (a',o `mappend` o') where (a',o') = f a
>
> --
> Chris
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/libraries/attachments/20071203/41b0f24c/attachment-0001.htm


More information about the Libraries mailing list