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: exportreadIORef : HasIO io => IORef a -> io a
Read the value of an IORef.
Totality: total
Visibility: exportwriteIORef : 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: exportwriteIORef1 : 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: exportmodifyIORef : 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: exportatomically : 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