<br><br><div class="gmail_quote">On Fri, Nov 18, 2011 at 4:05 AM, Yves Parès <span dir="ltr">&lt;<a href="mailto:limestrael@gmail.com">limestrael@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;">
(Sorry for the double mail)<br>...so there is no way to do that inside the function passed to modifySTRef?<br>In other words, there is no way to ensure *inside* a function that its result will be evaluated strictly?</blockquote>
<div><br>modifySTRef looks like this (sugared up a bit):<br><br>modifySTRef r f = do<br>    x &lt;- readSTRef r<br>    writeSTRef r (f x)<br></div></div><br>Note that this writes the *thunk* (f x) to the STRef, and there is absolutely nothing you can do about it.  &quot;f&quot; isn&#39;t demanded by this function, let alone &quot;f x&quot;.<br>
<br>You can implement your own strict modifySTRef&#39; easily though, as other people in this thread have shown.<br>