<br><br><div class="gmail_quote">On Thu, Aug 12, 2010 at 1:25 PM, Wei Hu <span dir="ltr">&lt;<a href="mailto:wei.hoo@gmail.com">wei.hoo@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;">
Anyone care to explain why? I also tested a slightly changed program<br>
pasted below, and am very confused.<br>
<br>
&gt; main = do<br>
&gt;   -- This call doesn&#39;t terminate, why?<br>
&gt;   print $ nonTermination &quot;a&quot;<br>
&gt;   -- Comment the above line to test the rest of the code<br>
&gt;   -- RTS detects the loop and bails out<br>
&gt;   print $ process &quot;abc&quot;<br>
&gt;   -- Comment the above line to test the rest of the code<br>
&gt;   inp &lt;- readFile &quot;input&quot;<br>
&gt;   -- I&#39;m guessing (process inp) throws an exception,<br>
&gt;   -- and the handler closes all files, making a second close fail?<br>
<div class="im">&gt;   writeFile &quot;output&quot; $ process inp<br>
<br>
&gt; process :: String -&gt;  String<br>
</div><div class="im">&gt; process xs = blackhole where blackhole = tail blackhole<br>
<br>
</div>&gt; nonTermination :: String -&gt; String<br>
&gt; nonTermination _ = blackhole where blackhole = blackhole<br></blockquote><div><br></div><div>If you compile the program to use the non-threaded RTS does the behavior change?</div><div><br></div><div>Jason</div></div>