planet-mitchell-0.1.0: Planet Mitchell

Safe HaskellNone
LanguageHaskell2010

Concurrency.TVar

Contents

Synopsis

TVar

data TVar a #

Shared memory locations that support atomic memory transactions.

Instances
Eq (TVar a)

Since: base-4.8.0.0

Instance details

Defined in GHC.Conc.Sync

Methods

(==) :: TVar a -> TVar a -> Bool #

(/=) :: TVar a -> TVar a -> Bool #

PrimUnlifted (TVar a)

Since: primitive-0.6.4.0

Instance details

Defined in Data.Primitive.UnliftedArray

newTVar :: a -> STM (TVar a) #

Create a new TVar holding a value supplied

newTVarIO :: MonadIO m => a -> m (TVar a) #

Lifted version of newTVarIO

Since: unliftio-0.2.1.0

readTVar :: TVar a -> STM a #

Return the current value stored in a TVar.

readTVarIO :: MonadIO m => TVar a -> m a #

Lifted version of readTVarIO

Since: unliftio-0.2.1.0

writeTVar :: TVar a -> a -> STM () #

Write the supplied value into a TVar.

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

swapTVar :: TVar a -> a -> STM a #

Swap the contents of a TVar for a new value.

Since: stm-2.3

mkWeakTVar :: MonadUnliftIO m => TVar a -> m () -> m (Weak (TVar a)) #

Lifted version of mkWeakTVar

Since: unliftio-0.2.1.0