base-compat-0.12.1: A compatibility layer for base

Safe Haskell | Safe-Inferred
Language | Haskell2010

Data.IORef.Compat

Synopsis

- module Data.IORef
- modifyIORef' :: IORef a -> (a -> a) -> IO ()
- atomicModifyIORef' :: IORef a -> (a -> (a, b)) -> IO b
- atomicWriteIORef :: IORef a -> a -> IO ()

# Documentation

module Data.IORef

modifyIORef' :: IORef a -> (a -> a) -> IO () #

Strict version of `modifyIORef`

Since: base-4.6.0.0

atomicModifyIORef' :: IORef a -> (a -> (a, b)) -> IO b #

Strict version of `atomicModifyIORef`. This forces both the value stored in the `IORef` and the value returned. The new value is installed in the `IORef` before the returned value is forced. So

    atomicModifyIORef' ref (x -> (x+1, undefined))

will increment the `IORef` and then throw an exception in the calling thread.

Since: base-4.6.0.0

atomicWriteIORef :: IORef a -> a -> IO () #

Variant of `writeIORef` with the "barrier to reordering" property that `atomicModifyIORef` has.

Since: base-4.6.0.0