Safe Haskell | Safe-Inferred |
---|---|

Language | Haskell2010 |

This module corresponds to `TVar`

in "stm" package

## Synopsis

- data StrictTVar m a
- type LazyTVar m = TVar m
- toLazyTVar :: StrictTVar m a -> LazyTVar m a
- fromLazyTVar :: LazyTVar m a -> StrictTVar m a
- castStrictTVar :: LazyTVar m ~ LazyTVar n => StrictTVar m a -> StrictTVar n a
- newTVar :: MonadSTM m => a -> STM m (StrictTVar m a)
- newTVarIO :: MonadSTM m => a -> m (StrictTVar m a)
- readTVar :: MonadSTM m => StrictTVar m a -> STM m a
- readTVarIO :: MonadSTM m => StrictTVar m a -> m a
- writeTVar :: MonadSTM m => StrictTVar m a -> a -> STM m ()
- modifyTVar :: MonadSTM m => StrictTVar m a -> (a -> a) -> STM m ()
- stateTVar :: MonadSTM m => StrictTVar m s -> (s -> (a, s)) -> STM m a
- swapTVar :: MonadSTM m => StrictTVar m a -> a -> STM m a
- check :: MonadSTM m => Bool -> STM m ()
- labelTVar :: MonadLabelledSTM m => StrictTVar m a -> String -> STM m ()
- labelTVarIO :: MonadLabelledSTM m => StrictTVar m a -> String -> m ()
- traceTVar :: MonadTraceSTM m => proxy m -> StrictTVar m a -> (Maybe a -> a -> InspectMonad m TraceValue) -> STM m ()
- traceTVarIO :: MonadTraceSTM m => StrictTVar m a -> (Maybe a -> a -> InspectMonad m TraceValue) -> m ()

# StrictTVar

data StrictTVar m a Source #

toLazyTVar :: StrictTVar m a -> LazyTVar m a Source #

Get the underlying `TVar`

Since we obviously cannot guarantee that updates to this `LazyTVar`

will be
strict, this should be used with caution.

fromLazyTVar :: LazyTVar m a -> StrictTVar m a Source #

castStrictTVar :: LazyTVar m ~ LazyTVar n => StrictTVar m a -> StrictTVar n a Source #

Cast the monad if both use the same representation of `TVar`

s.

This function is useful for monad transformers stacks if the `TVar`

is used
in different monad stacks.

newTVarIO :: MonadSTM m => a -> m (StrictTVar m a) Source #

readTVarIO :: MonadSTM m => StrictTVar m a -> m a Source #

modifyTVar :: MonadSTM m => StrictTVar m a -> (a -> a) -> STM m () Source #

# MonadLabelSTM

labelTVar :: MonadLabelledSTM m => StrictTVar m a -> String -> STM m () Source #

labelTVarIO :: MonadLabelledSTM m => StrictTVar m a -> String -> m () Source #

# MonadTraceSTM

traceTVar :: MonadTraceSTM m => proxy m -> StrictTVar m a -> (Maybe a -> a -> InspectMonad m TraceValue) -> STM m () Source #

traceTVarIO :: MonadTraceSTM m => StrictTVar m a -> (Maybe a -> a -> InspectMonad m TraceValue) -> m () Source #