<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto">Thanks everyone for feedback on this. I’ve opened a PR at <a href="https://github.com/ghc/ghc/pull/87">https://github.com/ghc/ghc/pull/87</a> and any commentary on the haddock changes there is appreciated.<br><br><div id="AppleMailSignature">Sent from my iPhone</div><div><br>On Nov 12, 2017, at 11:17 AM, Andrew Martin <<a href="mailto:andrew.thaddeus@gmail.com">andrew.thaddeus@gmail.com</a>> wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr">In the stm package, the docs for atomically read:<br><br><div>> You cannot use 'atomically' inside an 'unsafePerformIO' or 'unsafeInterleaveIO'. Any attempt to do so will result in a runtime error. (Reason: allowing this would effectively allow a transaction inside a transaction, depending on exactly when the thunk is evaluated.)</div><div><br></div><div>This doesn't seem to be true. The following program runs fine:</div><div><br></div><div><div> import Control.Monad.STM</div><div> import Control.Concurrent.STM.TVar</div><div> import System.IO.Unsafe</div><div> </div><div> main :: IO ()</div><div> main = do</div><div> v <- atomically $ newTVar (7 :: Int)</div><div> print $ unsafePerformIO $ atomically $ do</div><div> readTVar v</div><div><br></div><div>I suspect that the runtime only gives you an error if you actually create a nested transaction. Is my understanding correct?</div><div><br><div class="gmail_signature">-Andrew Thaddeus Martin</div>
</div></div></div>
</div></blockquote></body></html>