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

Chris Kuklewicz haskell at list.mightyreason.com
Mon Dec 3 13:41:27 EST 2007


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


More information about the Libraries mailing list