<div>And the important observation is: all of them throw A if interpreted in ghci or compiled without -O, right?</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Nov 8, 2012 at 11:24 AM, Albert Y. C. Lai <span dir="ltr">&lt;<a href="mailto:trebla@vex.net" target="_blank">trebla@vex.net</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 12-11-08 07:12 AM, Simon Hengel wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
I was just going to say that I can give at least one counterexample<br>
where this does not hold:<br>
<br>
   evaluate ((&#39;a&#39; : undefined) `deepseq` return () :: IO ())<br>
   throwIO exceptionB<br>
<br>
But then I realized that here exceptionA is optimized away altogether.<br>
For me this smells like a bug.  Is this related to [1]?<br>
<br></div>
[1] <a href="http://hackage.haskell.org/trac/ghc/ticket/2273" target="_blank">http://hackage.haskell.org/<u></u>trac/ghc/ticket/2273</a><br>
</blockquote>
<br>
Interesting. A few more tests (all GHC 7.4.2, linux, x86 32-bit, use &quot;ghc -O&quot; to compile):<br>
<br>
The following cases throw A:<br>
<br>
import Control.DeepSeq<br>
import Control.Exception<br>
<br>
main = do<br>
  evaluate ((&#39;a&#39; : error &quot;A&quot;) `deepseq` return () :: Maybe ())<br>
  throwIO (userError &quot;B&quot;)<br>
<br>
main = do<br>
  evaluate ((&#39;a&#39; : error &quot;A&quot;) `deepseq` ())<br>
  throwIO (userError &quot;B&quot;)<br>
<br>
main = do<br>
  evaluate ((&#39;a&#39; : error &quot;A&quot;) `deepseq` True)<br>
  throwIO (userError &quot;B&quot;)<br>
<br>
main = do<br>
  x &lt;- evaluate ((&#39;a&#39; : error &quot;A&quot;) `deepseq` putStrLn &quot;hi&quot;)<br>
  x<br>
  throwIO (userError &quot;B&quot;)<br>
<br>
The following cases throw B:<br>
<br>
main = do<br>
  evaluate ((&#39;a&#39; : error &quot;A&quot;) `deepseq` return () :: IO ())<br>
  throwIO (userError &quot;B&quot;)<br>
<br>
main = do<br>
  evaluate ((&#39;a&#39; : error &quot;A&quot;) `deepseq` putStrLn &quot;hi&quot;)<br>
  throwIO (userError &quot;B&quot;)<br>
<br>
main = do<br>
  evaluate ((&#39;a&#39; : error &quot;A&quot;) `deepseq` getLine)<br>
  throwIO (userError &quot;B&quot;)<div class="HOEnZb"><div class="h5"><br>
<br>
______________________________<u></u>_________________<br>
Glasgow-haskell-users mailing list<br>
<a href="mailto:Glasgow-haskell-users@haskell.org" target="_blank">Glasgow-haskell-users@haskell.<u></u>org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/glasgow-haskell-users" target="_blank">http://www.haskell.org/<u></u>mailman/listinfo/glasgow-<u></u>haskell-users</a><br>
</div></div></blockquote></div><br></div>