atomicWriteIORef r a = atomicModifyIORef r $ const (a, ())
ref <- newIORef 0 replicateM_ 1000000 $ modifyIORef ref (+1) readIORef ref >>= printTo avoid this problem, use modifyIORef' instead.
newIORef = newIORefN ""
readIORef ioref = readForCAS ioref >>= peekTicket
modifyIORefCAS_ ioref f = modifyIORefCAS ioref (\a -> (f a, ()))
newIORefN _ = newIORef