
26 Apr
2014
26 Apr
'14
11:54 p.m.
* Ross Paterson
On Sat, Apr 26, 2014 at 11:29:01PM +0300, Roman Cheplyaka wrote:
I don't understand the issue here. Why does it have to be abstract or based on StateT?
We could simply make a new module with the same WriterT type and the instance
instance (Monoid w, Monad m) => Monad (WriterT w m) where m >>= k = WriterT $ do (a, w) <- runWriterT m (b, w') <- runWriterT (k a) let w'' = w `mappend` w' w'' `seq` return (b, w'')
See Gabriel's analysis:
http://www.haskell.org/pipermail/libraries/2013-March/019528.html
The above is version #2 there.
Very illuminating, thanks. Roman