The strictness of Control.Monad.State.Strict has to do with the strictness of the tuple constructor, not of the state per se. The dichotomy between Lazy and Strict comes from the competing desires to fake products as categorical products that don&#39;t introduce _|_&#39;s of their own and the lifted products we have in Haskell which do. The former leads you to the .Lazy model, the latter leads you to the .Strict model. The former is nicer for certain lazy knot tying tricks. The latter is easier to reason about when you start throwing fmap _|_&#39;s around.<div>
<br></div><div>However, a Strict State or Writer is not actually strict in the state or log. This is admittedly a somewhat common misconception.</div><div><br></div><div>My concern is that such a combinator would exacerbate this confusion and that it doesn&#39;t generalize. e.g. This trick doesn&#39;t generalize to Strict.Writer, where you can `tell&#39;`, but then you lose than on the next bind after you lazily smash it into something that is probably just mempty.</div>
<div><div><br></div><div>I&#39;m not against noting that put/modify is not the thing that we are &#39;Strict&#39; in more carefully though.</div><div><br></div><div>-Edward<br><br><div class="gmail_quote">On Thu, Sep 27, 2012 at 11:11 PM, Ben Gamari <span dir="ltr">&lt;<a href="mailto:bgamari.foss@gmail.com" target="_blank">bgamari.foss@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Is there a reason there is no `modify` operation in<br>
Control.Monad.State.Strict (and the transformers analogue) which is<br>
truly strict in the state? That is,<br>
<br>
    modify&#39; :: Monad m =&gt; (a -&gt; a) -&gt; StateM a m ()<br>
    modify&#39; f = get &gt;&gt;= (\x -&gt; put $! f x)<br>
<br>
While this is admittedly not a difficult piece of code to write, even<br>
the suggestion in the documentation that `modify` isn&#39;t as strict as one<br>
might think would likely save many man-hours of debugging (especially<br>
for those who are less familiar with the language, for whom, speaking<br>
from experience, strictness issues can pose a major hurdle to adoption)<br>
<br>
In general it would be nice if the notion of strictness were better<br>
addressed in the major libraries&#39; documentation. It&#39;s a nuanced<br>
issue which is not fully captured by a &quot;.Lazy&quot; or &quot;.Strict&quot; in the<br>
module name.<br>
<br>
Just a thought.<br>
<br>
Thanks,<br>
<br>
- Ben<br>
<br>
<br>
_______________________________________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org">Libraries@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/libraries" target="_blank">http://www.haskell.org/mailman/listinfo/libraries</a><br>
</blockquote></div><br></div></div>