Idris2Doc : Data.IORef

Data.IORef

Definitions

data IORef : Type -> Type
Totality: total
Visibility: export
Constructor: 
MkRef : Mut a -> IORef a
newIORef : HasIO io => a -> io (IORef a)
  Create a new IORef.

Totality: total
Visibility: export
readIORef : HasIO io => IORef a -> io a
  Read the value of an IORef.

Totality: total
Visibility: export
writeIORef : HasIO io => IORef a -> a -> io ()
  Write a new value into an IORef.
This function does not create a memory barrier and can be reordered with other independent reads and writes within a thread,
which may cause issues for multithreaded execution.

Totality: total
Visibility: export
writeIORef1 : HasLinearIO io => IORef a -> (1 _ : a) -> io ()
  Write a new value into an IORef.
This function does not create a memory barrier and can be reordered with other independent reads and writes within a thread,
which may cause issues for multithreaded execution.

Totality: total
Visibility: export
modifyIORef : HasIO io => IORef a -> (a -> a) -> io ()
  Mutate the contents of an IORef, combining readIORef and writeIORef.
This is not an atomic update, consider using atomically when operating in a multithreaded environment.

Totality: total
Visibility: export
atomically : HasIO io => Mutex -> io () -> io ()
  This function atomically runs its argument according to the provided mutex.
It can for instance be used to modify the contents of an IORef `ref` with a function `f`
in a safe way in a multithreaded program by using `atomically lock (modifyIORef ref f)`
provided that other threads also rely on the same `lock` to modify `ref`.

Totality: total
Visibility: export