Copyright | (c) 2016 Stephen Diehl (c) 2016-2018 Serokell (c) 2018-2019 Kowainik |
---|---|
License | MIT |
Maintainer | Kowainik <xrom.xkov@gmail.com> |
Safe Haskell | Trustworthy |
Language | Haskell2010 |
Lifted reexports from IORef
module.
Synopsis
- data IORef a
- atomicModifyIORef :: MonadIO m => IORef a -> (a -> (a, b)) -> m b
- atomicModifyIORef' :: MonadIO m => IORef a -> (a -> (a, b)) -> m b
- atomicWriteIORef :: MonadIO m => IORef a -> a -> m ()
- modifyIORef :: MonadIO m => IORef a -> (a -> a) -> m ()
- modifyIORef' :: MonadIO m => IORef a -> (a -> a) -> m ()
- newIORef :: MonadIO m => a -> m (IORef a)
- readIORef :: MonadIO m => IORef a -> m a
- writeIORef :: MonadIO m => IORef a -> a -> m ()
Documentation
A mutable variable in the IO
monad
Instances
NFData1 IORef | Since: deepseq-1.4.3.0 |
Defined in Control.DeepSeq | |
Eq (IORef a) | Pointer equality. Since: base-4.0.0.0 |
NFData (IORef a) | NOTE: Only strict in the reference and not the referenced value. Since: deepseq-1.4.2.0 |
Defined in Control.DeepSeq |
atomicModifyIORef :: MonadIO m => IORef a -> (a -> (a, b)) -> m b Source #
Lifted version of atomicModifyIORef
.
>>>
ref <- newIORef 42
>>>
atomicModifyIORef ref (\a -> (a, a + 3))
45>>>
readIORef ref
42
atomicModifyIORef' :: MonadIO m => IORef a -> (a -> (a, b)) -> m b Source #
Lifted version of atomicModifyIORef'
.
>>>
ref <- newIORef 42
>>>
atomicModifyIORef' ref (\a -> (a, a + 3))
45>>>
readIORef ref
42
atomicWriteIORef :: MonadIO m => IORef a -> a -> m () Source #
Lifted version of atomicWriteIORef
.
>>>
ref <- newIORef 42
>>>
atomicWriteIORef ref 45
>>>
readIORef ref
45
modifyIORef :: MonadIO m => IORef a -> (a -> a) -> m () Source #
Lifted version of modifyIORef
.
>>>
ref <- newIORef 42
>>>
modifyIORef ref (\a -> a + 6)
>>>
readIORef ref
48
modifyIORef' :: MonadIO m => IORef a -> (a -> a) -> m () Source #
Lifted version of modifyIORef'
.
>>>
ref <- newIORef 42
>>>
modifyIORef' ref (\a -> a + 3)
>>>
readIORef ref
45
newIORef :: MonadIO m => a -> m (IORef a) Source #
Lifted version of newIORef
.
>>>
ref <- newIORef False
>>>
:t ref
ref :: IORef Bool
readIORef :: MonadIO m => IORef a -> m a Source #
Lifted version of readIORef
.
>>>
ref <- newIORef 42
>>>
readIORef ref
42
writeIORef :: MonadIO m => IORef a -> a -> m () Source #
Lifted version of writeIORef
.
>>>
ref <- newIORef 42
>>>
writeIORef ref 43
>>>
readIORef ref
43