Proposal: Make StateT in mtl lazy

Chris Kuklewicz haskell at list.mightyreason.com
Tue Jan 30 12:07:18 EST 2007


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'.

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.

Ian Lynagh wrote:
> http://hackage.haskell.org/trac/ghc/ticket/1127
> 
> Deadline: 28 February 2007.
> 
> I propose we make StateT lazy, as I suspect was the intention all along
> and as has been discussed (without reaching a conclusion) before.
> 
> The patch is simply (in the definition of (>>=)):
> 
> hunk ./Control/Monad/State.hs 195
> -               (a, s') <- runStateT m s
> +               ~(a, s') <- runStateT m s
> 
> 
> Thanks
> Ian
> 
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries



More information about the Libraries mailing list