atomically
Perform a series of STM actions atomically.
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.)
However, see newTVarIO, which can be called inside unsafePerformIO, and which allows top-level TVars to be allocated.
The runtime detected an attempt to nest one STM transaction inside another one, presumably due to the use of unsafePeformIO with atomically.
Thrown when the program attempts to call atomically, from the stm package, inside another call to atomically.