Sorry, thought I had replied to this with my result!<div><br></div><div>I added `seq` and $! inside `stuffToDo` to ensure that there weren&#39;t any thunks left around after it was called.</div><div><br></div><div>The measured times were only a few hundredths of a second apart after that.</div>
<div><br></div><div>So, apparently even with a strict StateT, partially evaluated references can easily be left around all the way until the call to runStateT returns. In this case my state is a record, if that makes any difference. It&#39;s not what I expected... I can see why my example is too small to show why it behaved this way though.</div>
<div><br></div><div>I thought pattern matching (in Haskell98) was itself strict, so I don&#39;t see what the difference between a lazy and strict stateT is, except perhaps in cases that the value of runStateT is bound via a different mechanism than pattern matching. </div>
<div><br><div class="gmail_quote">On Sat, Oct 22, 2011 at 6:13 AM, Daniel Fischer <span dir="ltr">&lt;<a href="mailto:daniel.is.fischer@googlemail.com">daniel.is.fischer@googlemail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div><div class="h5">On Saturday 22 October 2011, 13:55:36, Bas van Dijk wrote:<br>
&gt; On 20 October 2011 22:16, thomas burt &lt;<a href="mailto:thedwards@gmail.com">thedwards@gmail.com</a>&gt; wrote:<br>
&gt; &gt; Perhaps I will try and force `stuffToDo` not to leave any partially<br>
&gt; &gt; evaluated thunks behind.... and compare the cost then.<br>
&gt;<br>
&gt; What happens when you switch to a strict StateT?<br>
<br>
</div></div>He already uses the strict StateT:<br>
<div class="im"><br>
&gt; By the way I&#39;m using ghc-6.10.4 and Control.Monad.Trans.State.Strict.<br>
<br>
</div>We need to see more of the code to find out what&#39;s going on.<br>
</blockquote></div><br></div>