
On Thu, Sep 15, 2011 at 4:43 PM, Matt Brown
Hello all,
I've been debugging a space leak, and believe I've traced it to a chain of unevaluated calls to mappend in the bind operator for Control.Monad.Writer.Strict. I had expected these calls to be evaluated strictly by the strict Writer, but it doesn't seem to be the case. Am I understanding this correctly?
The Strict in Control.Monad.Writer.Strict refers to the fact that the tuple is matched strictly -- not the Monoid.
If so, is this the intended behavior?
The Strict/Lazy writer split has nothing to do with the strictness of your monoid, but rather whether or not operations such as:
fmap f ~(w, a) = (w, f a)
or
fmap f (w, a) = (w, f a)
are used throughout the API. We default to Lazy because slightly more code can terminate (at least in the case of State), lthough some would challenge that due to the behavior in the presence of bottoms the Strict versions are more correct. Neither of these are, or are intended to be, the monad you are looking for. -Edward Kmett