[Haskell-cafe] State monad strictness - how?
ross at soi.city.ac.uk
Wed Jan 10 20:18:05 EST 2007
On Wed, Jan 10, 2007 at 10:02:36AM -0800, Iavor Diatchki wrote:
> [Yitzchak Gale:]
> >Unfortunately, the current situation is that State is only
> >available as a lazy monad, and StateT is only available
> >as a strict monad.
> There is no such distinction in monadLib. The state transformer
> inherits its behavior from the underlying monad. For example: StateT
> Int IO is strict, but StatT Int Id is lazy. One way to get a strict
> state monad with monadLib is like this:
> [strict pseudo-monad]
This (like StateT) gives you strictness in the pair, but doesn't give
the strictness in the state that the original poster wanted.
More information about the Haskell-Cafe