module Data.IORef.Extra(
module Data.IORef,
writeIORef', atomicWriteIORef',
atomicModifyIORef_, atomicModifyIORef'_
) where
import Data.IORef
import Control.Exception
writeIORef' :: IORef a -> a -> IO ()
writeIORef' ref x = do
evaluate x
writeIORef ref x
atomicWriteIORef' :: IORef a -> a -> IO ()
atomicWriteIORef' ref x = do
evaluate x
atomicWriteIORef ref x
atomicModifyIORef_ :: IORef a -> (a -> a) -> IO ()
atomicModifyIORef_ r f = atomicModifyIORef r $ \v -> (f v, ())
atomicModifyIORef'_ :: IORef a -> (a -> a) -> IO ()
atomicModifyIORef'_ r f = atomicModifyIORef' r $ \v -> (f v, ())