IORef package:effectful

Lifted Data.IORef. Note: it requires Prim because MutVar from the primitive library is a generalization of IORef.
A mutable variable in the IO monad.
>>> import Data.IORef

>>> r <- newIORef 0

>>> readIORef r
0

>>> writeIORef r 1

>>> readIORef r
1

>>> atomicWriteIORef r 2

>>> readIORef r
2

>>> modifyIORef' r (+ 1)

>>> readIORef r
3

>>> atomicModifyIORef' r (\a -> (a + 1, ()))

>>> readIORef r
4
See also STRef and MVar.
A strict (WHNF) variant of IORef.
Lifted mkWeakIORef. Note: the finalizer will run a cloned environment, so any changes it makes to thread local data will not be visible outside of it.
Lifted mkWeakIORef'. Note: the finalizer will run a cloned environment, so any changes it makes to thread local data will not be visible outside of it.