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

3 Dec
2007
3 Dec
'07
1:50 p.m.
Hi Chris. I don't think that version could type-check. Try it out. -
Conal
On Dec 3, 2007 8:52 AM, Chris Kuklewicz
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
6379
Age (days ago)
6379
Last active (days ago)
0 comments
1 participants
participants (1)
-
Conal Elliott