Document for review: evaluation order and state tokens

Bertram Felgenhauer bertram.felgenhauer at
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:

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

but it has been around for a long time.



More information about the Glasgow-haskell-users mailing list