
Hello,
On Mon, Oct 13, 2008 at 3:16 PM, Stephen Hicks
2008/10/13 Daryoush Mehrtash
: Is there a write up on what makes an implementation lazy vs strict?
I would be interested in seeing this, too!
Typically it has to do with the strictness of the "bind" operation. Here is an example to illustrate the difference. evalState (undefined >> return True) undefined When you evaluate this in the context of Control.Monad.State, the result is "True", while if you evaluate it in the context of Control.Monad.State.Strict you will get "undefined". It may be interesting to compare MTL's approach to what's done in monadLib (another monad transformer library). In monadLib, transformers like state inherit the strictness of their bind operation from the underlying monad. There are two base level monads: Id, which is lazy, and Lift which is strict. So to get a strict state monad in monadLIb, you would write "StateT s Lift", and to get the lazy version you would use "StateT s Id". Hope that this helps, Iavor