Safe Haskell | None |
---|
Utility functions for working with IORefs.
Synopsis
- atomicModifyWithLens :: MonadBase IO m => IORef a -> Lens a a b c -> (b -> (r, c)) -> m r
- atomicModifyIORefErr :: MonadBase IO m => IORef a -> (a -> GenericResult e (a, b)) -> ResultT e m b
- atomicModifyIORefErrLog :: (MonadBase IO m, MonadLog m) => IORef a -> (a -> ResultT e WriterLog (a, b)) -> ResultT e m b
Documentation
atomicModifyWithLens :: MonadBase IO m => IORef a -> Lens a a b c -> (b -> (r, c)) -> m r Source #
Atomically modifies an IORef
using a lens
atomicModifyIORefErr :: MonadBase IO m => IORef a -> (a -> GenericResult e (a, b)) -> ResultT e m b Source #
Atomically modifies an IORef
using a function that can possibly fail.
If it fails, the value of the IORef
is preserved.
atomicModifyIORefErrLog :: (MonadBase IO m, MonadLog m) => IORef a -> (a -> ResultT e WriterLog (a, b)) -> ResultT e m b Source #
Atomically modifies an IORef
using a function that can possibly fail
and log errors.
If it fails, the value of the IORef
is preserved.
Any log messages are passed to the outer monad.