STM and unsafePerformIO
Robert van Herk
rherk at cs.uu.nl
Wed Aug 3 06:50:54 EDT 2005
I think I've read somewhere that STM doesn't like unsafePerformIO.
However, I would like to use a global STM variable. Something like this:
*module* Main *where*
tSid = unsafePerformIO (atomically (newTVar 0))
tickSessionID :: STM Int
*do* sid <- readTVar tSid
writeTVar tSid (sid + 1)
main = atomically tickSessionID
But, when I try this, the evaluation of main causes a segmentation
fault. Is there a workaround for this bug?
More information about the Glasgow-haskell-users