Guarantees for ST and IO shared in common?

Christopher Allen cma at bitemyapp.com
Wed Feb 3 23:30:21 UTC 2016


Underlying ST is: GHC.Prim.State# s -> (# GHC.Prim.State# s, a #)

Underlying IO is: GHC.Prim.State# GHC.Prim.RealWorld
        -> (# GHC.Prim.State# GHC.Prim.RealWorld, a #)

Based on the (very helpful!) conversation I had on the #ghc IRC channel, it
seems to me that the mechanism for preventing things like reordering
operations or spurious sharing is shared in common between ST and IO via
State#. Is this accurate? I believe the exception is how RealWorld is used
w/ IO but we can put that off for this question.

If anyone could confirm this understanding that would be helpful. If anyone
could point out exceptions to this notion, I'd very much appreciate that as
well.


Thanks again for everyone's time.

-- 
Chris Allen
Currently working on http://haskellbook.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20160203/458eb88c/attachment.html>


More information about the ghc-devs mailing list