TVar package:concurrency
Transactional variables, for use with
MonadSTM.
Deviations: There is no
Eq instance for
MonadSTM the
TVar type. Furthermore, the
newTVarIO and
mkWeakTVar functions are not provided.
Mutate the contents of a
TVar. This is non-strict.
Mutate the contents of a
TVar strictly.
Create a new
TVar containing the given value.
newTVar = newTVarN ""
Create a new
TVar containing the given value, but it is given
a name which may be used to present more useful debugging information.
If an empty name is given, a counter starting from 0 is used. If names
conflict, successive
TVars with the same name are given a
numeric suffix, counting up from 1.
newTVarN _ = newTVar
Return the current value stored in a TVar.
Read the current value stored in a
TVar. This may be
implemented differently for speed.
readTVarConc = atomically . readTVar
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.
Swap the contents of a
TVar, returning the old value.
Write the supplied value into the TVar.
Create a
TVar. This may be implemented differently for speed.
newTVarConc = atomically . newTVar