Control.Monad.Writer.Strict .... enough?

15 Jan
2009
15 Jan
'09
2:48 p.m.
Hi, In most of the 'mtl' variants on Hackage (with the notable exception of 'monadLib'), the Control.Monad.Writer.Strict main instance is: newtype Writer w a = Writer { runWriter :: (a, w) } instance (Monoid w) => Monad (Writer w) where return a = Writer (a, mempty) m >>= k = Writer $ case runWriter m of (a, w) -> case runWriter (k a) of (b, w') -> (b, w `mappend` w') ...ie the `mappend` is hidden inside a lazy "(,)" constructor. ...shouldn't the bind really be strict in the written monoid? (eg by replacing "(a,w)" with "(a,!w)" and using Bang Patterns). ...if so, is it worth submitting patch? --Ben
5969
Age (days ago)
5969
Last active (days ago)
0 comments
1 participants
participants (1)
-
Ben Moseley