Skip to content

Nested 'atomically' should raise an exception

Using 'atomically' inside an unsafePerformIO, inside 
another 'atomically' should raise an exception.  
Currently, it seg-faults.

Here's an example:

    import Control.Concurrent.STM
    import System.IO.Unsafe (unsafePerformIO)

    {-# NOINLINE var #-}
    var :: TVar ()
    var = unsafePerformIO (atomically (newTVar ()))

    main = atomically (readTVar var)

Simon
Edited by Simon Marlow
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information