Document for review: evaluation order and state tokens
Bertram Felgenhauer
bertram.felgenhauer at googlemail.com
Mon Aug 25 18:37:57 UTC 2014
Dear Michael,
Michael Snoyman wrote:
> As part of trac ticket 9390[1], Simon PJ recommended that we try to get a
> document written that clarifies some of the issues regarding evaluation
> order, and get it included in the GHC wiki. After a few iterations with
> review from Simon, I've got a first "publicly consumable" version available
> at:
>
> https://www.fpcomplete.com/user/snoyberg/general-haskell/advanced/evaluation-order-and-state-tokens
Thanks for writing this, it looks very useful.
> I'd appreciate any feedback on this document before I add it to the wiki.
[on unsafeDupablePerformIO]
| And when the first thread completes the action, it may terminate the
| execution of the other thread.
I think it's worthwhile to stress that "bracket" does not help, because
evaluation of the thunk in the other thread simply stops, without
throwing an exception.
Could you add something about unsafePerformIO inside STM? The upshot is
that you get the behaviour of unsafeDupablePerformIO, except for the
parallelism: When an STM transaction is interrupted to be retried, its
evaluation simply stops. This is a known bug which causes real problems
with FFI bindings, see
https://ghc.haskell.org/trac/ghc/ticket/2401
http://www.haskell.org/pipermail/haskell-cafe/2014-February/112555.html
but it has been around for a long time.
Cheers,
Bertram
More information about the Glasgow-haskell-users
mailing list