Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data TVar a
- newTVar :: a -> STM (TVar a)
- newTVarIO :: MonadIO m => a -> m (TVar a)
- readTVar :: TVar a -> STM a
- readTVarIO :: MonadIO m => TVar a -> m a
- writeTVar :: TVar a -> a -> STM ()
- modifyTVar :: TVar a -> (a -> a) -> STM ()
- modifyTVar' :: TVar a -> (a -> a) -> STM ()
- stateTVar :: TVar s -> (s -> (a, s)) -> STM a
- swapTVar :: TVar a -> a -> STM a
- mkWeakTVar :: MonadUnliftIO m => TVar a -> m () -> m (Weak (TVar a))
TVar
Shared memory locations that support atomic memory transactions.
Instances
Eq (TVar a) | Since: base-4.8.0.0 |
PrimUnlifted (TVar a) | Since: primitive-0.6.4.0 |
Defined in Data.Primitive.UnliftedArray toArrayArray# :: TVar a -> ArrayArray# # fromArrayArray# :: ArrayArray# -> TVar a # |
readTVarIO :: MonadIO m => TVar a -> m a #
Lifted version of readTVarIO
Since: unliftio-0.2.1.0
modifyTVar :: TVar a -> (a -> a) -> STM () #
Mutate the contents of a TVar
. N.B., this version is
non-strict.
Since: stm-2.3
modifyTVar' :: TVar a -> (a -> a) -> STM () #
Strict version of modifyTVar
.
Since: stm-2.3
stateTVar :: TVar s -> (s -> (a, s)) -> STM a #
Like modifyTVar'
but the function is a simple state transition that can
return a side value which is passed on as the result of the STM
.
Since: stm-2.5.0
mkWeakTVar :: MonadUnliftIO m => TVar a -> m () -> m (Weak (TVar a)) #
Lifted version of mkWeakTVar
Since: unliftio-0.2.1.0