<br><br><div class="gmail_quote">On Thu, Aug 12, 2010 at 1:25 PM, Wei Hu <span dir="ltr"><<a href="mailto:wei.hoo@gmail.com">wei.hoo@gmail.com</a>></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>
> main = do<br>
> -- This call doesn't terminate, why?<br>
> print $ nonTermination "a"<br>
> -- Comment the above line to test the rest of the code<br>
> -- RTS detects the loop and bails out<br>
> print $ process "abc"<br>
> -- Comment the above line to test the rest of the code<br>
> inp <- readFile "input"<br>
> -- I'm guessing (process inp) throws an exception,<br>
> -- and the handler closes all files, making a second close fail?<br>
<div class="im">> writeFile "output" $ process inp<br>
<br>
> process :: String -> String<br>
</div><div class="im">> process xs = blackhole where blackhole = tail blackhole<br>
<br>
</div>> nonTermination :: String -> String<br>
> 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>