[Haskell-cafe] State monad strictness - how?
heringtonlacey at mindspring.com
Wed Jan 10 14:41:39 EST 2007
At 11:02 AM +0200 1/10/07, Yitzchak Gale wrote:
>Unfortunately, the current situation is that State is only
>available as a lazy monad, and StateT is only available
>as a strict monad.
>The obvious solution would be to have available
>both a lazy and a strict version of each monad: State,
>State', StateT, and State'T (or some such), with functions to
>convert between them. It is trivial to implement that in
>the current library.
First, thanks for the very helpful reply explaining the situation.
Second, how would one know that State is lazy and StateT is strict?
I don't see that in the Haddock documentation.
Third, isn't it a continuum rather than a binary choice between lazy
and strict? In my example, I used ($!) in the definition of (>>=),
but that's just one flavor of strictness that was appropriate to my
example. Is there some way to parameterize this degree of strictness?
More information about the Haskell-Cafe