<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Aug 25, 2014 at 9:37 PM, Bertram Felgenhauer <span dir="ltr"><<a href="mailto:bertram.felgenhauer@googlemail.com" target="_blank">bertram.felgenhauer@googlemail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear Michael,<br>
<div class=""><br>
Michael Snoyman wrote:<br>
> As part of trac ticket 9390[1], Simon PJ recommended that we try to get a<br>
> document written that clarifies some of the issues regarding evaluation<br>
> order, and get it included in the GHC wiki. After a few iterations with<br>
> review from Simon, I've got a first "publicly consumable" version available<br>
> at:<br>
><br>
> <a href="https://www.fpcomplete.com/user/snoyberg/general-haskell/advanced/evaluation-order-and-state-tokens" target="_blank">https://www.fpcomplete.com/user/snoyberg/general-haskell/advanced/evaluation-order-and-state-tokens</a><br>


<br>
</div>Thanks for writing this, it looks very useful.<br>
<div class=""><br>
> I'd appreciate any feedback on this document before I add it to the wiki.<br>
<br>
</div>[on unsafeDupablePerformIO]<br>
| And when the first thread completes the action, it may terminate the<br>
| execution of the other thread.<br>
<br>
I think it's worthwhile to stress that "bracket" does not help, because<br>
evaluation of the thunk in the other thread simply stops, without<br>
throwing an exception.<br>
<br>
<br>
Could you add something about unsafePerformIO inside STM? The upshot is<br>
that you get the behaviour of unsafeDupablePerformIO, except for the<br>
parallelism: When an STM transaction is interrupted to be retried, its<br>
evaluation simply stops. This is a known bug which causes real problems<br>
with FFI bindings, see<br>
<br>
  <a href="https://ghc.haskell.org/trac/ghc/ticket/2401" target="_blank">https://ghc.haskell.org/trac/ghc/ticket/2401</a><br>
  <a href="http://www.haskell.org/pipermail/haskell-cafe/2014-February/112555.html" target="_blank">http://www.haskell.org/pipermail/haskell-cafe/2014-February/112555.html</a><br>
<br>
but it has been around for a long time.<br>
<br>
Cheers,<br>
<br>
Bertram<br></blockquote></div><br></div><div class="gmail_extra">Thanks for the feedback, I've added information on both of these points to the document (STM in its own section at the bottom, as I couldn't find a good place where it fit with the existing flow).<br>

<br>Michael<br></div></div>