Data.IORef.Extra

extra-1.5.1: Extra functions I use.

Safe Haskell | Safe
Language | Haskell2010

Data.IORef.Extra

Description

This module extends Data.IORef with operations forcing the value written to the IORef. Some of these functions are available in later versions of GHC, but not all.

Synopsis

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

# Documentation

module Data.IORef

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

Strict version of `modifyIORef`

Since: 4.6.0.0

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

Evaluates the value before calling `writeIORef`.

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

Strict version of `atomicModifyIORef`. This forces both the value stored in the `IORef` as well as the value returned.

Since: 4.6.0.0

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

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

Since: 4.6.0.0

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

Evaluates the value before calling `atomicWriteIORef`.