Proposal: Make mtl lazier

Ian Lynagh igloo at earth.li
Wed Jan 31 07:53:46 EST 2007


On Tue, Jan 30, 2007 at 05:07:18PM +0000, Chris Kuklewicz wrote:
> I agree that the change improves the consistence of semantics.
> 
> You should amend the proposal to also explain how to restore the previous
> strictness using 'seq'.

I'm not sure what you mean?

> And if StateT is to be fixed, then the same fix should be applied to WriterT, as
> shown in http://haskell.org/haskellwiki/New_monads/LazyWriterT
> 
> And the same fix looks like it should be applied to RWST.
> 
> ErrorT I believe is supposed to be Strict, so it can stop when a (Left _) is found.

Hmm, now I look closer there are a number of other places that look like
they could benefit from a ~. I've attached a new patch and unified diff
of them all to the proposal

    http://hackage.haskell.org/trac/ghc/ticket/1127

and changed the description to match its increased scope.

The changes only affect transformers except for:

     listens :: (MonadWriter w m) => (w -> b) -> m a -> m (a, b)
     listens f m = do
    -   (a, w) <- listen m
    +   ~(a, w) <- listen m
        return (a, f w)

in Control/Monad/Writer.hs


Thanks
Ian



More information about the Libraries mailing list