Memory location that supports select few atomic operations.
Isomorphic to IORef Int.
:: a typeCtrl KGHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05
Moduleatomic-counter-0.1.2.4Haskell2010
Work with lifted Counter values in the IO monad. Please see other modules in this package for ST monad and for unlifted values.
Memory location that supports select few atomic operations.
Isomorphic to IORef Int.
Create new counter with initial value.
Atomically read the counter's value.
Atomically assign new value to the counter.
Atomic compare and swap, i.e. write the new value if the current value matches the provided old value. Returns the value of the element before the operation
Atomically add an amount to the counter and return its old value.
Atomically subtract an amount from the counter and return its old value.
Atomically combine old value with a new one via bitwise and. Returns old counter value.
Atomically combine old value with a new one via bitwise or. Returns old counter value.
Atomically combine old value with a new one via bitwise xor. Returns old counter value.
Atomically combine old value with a new one via bitwise nand. Returns old counter value.