Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module corresponds to TVar
in "stm" package
Synopsis
- type family TVar (m :: Type -> Type) :: Type -> Type
- newTVar :: MonadSTM m => a -> STM m (TVar m a)
- newTVarIO :: MonadSTM m => a -> m (TVar m a)
- readTVar :: MonadSTM m => TVar m a -> STM m a
- readTVarIO :: MonadSTM m => TVar m a -> m a
- writeTVar :: MonadSTM m => TVar m a -> a -> STM m ()
- modifyTVar :: MonadSTM m => TVar m a -> (a -> a) -> STM m ()
- modifyTVar' :: MonadSTM m => TVar m a -> (a -> a) -> STM m ()
- stateTVar :: MonadSTM m => TVar m s -> (s -> (a, s)) -> STM m a
- swapTVar :: MonadSTM m => TVar m a -> a -> STM m a
- check :: MonadSTM m => Bool -> STM m ()
- labelTVar :: MonadLabelledSTM m => TVar m a -> String -> STM m ()
- labelTVarIO :: MonadLabelledSTM m => TVar m a -> String -> m ()
- traceTVar :: MonadTraceSTM m => proxy m -> TVar m a -> (Maybe a -> a -> InspectMonad m TraceValue) -> STM m ()
- traceTVarIO :: MonadTraceSTM m => TVar m a -> (Maybe a -> a -> InspectMonad m TraceValue) -> m ()
- debugTraceTVar :: forall (m :: Type -> Type) a proxy. (MonadTraceSTM m, Show a) => proxy m -> TVar m a -> STM m ()
- debugTraceTVarIO :: (MonadTraceSTM m, Show a) => TVar m a -> m ()
MonadSTM
readTVarIO :: MonadSTM m => TVar m a -> m a Source #
MonadLabelSTM
labelTVarIO :: MonadLabelledSTM m => TVar m a -> String -> m () Source #
MonadTraceSTM
:: MonadTraceSTM m | |
=> proxy m | |
-> TVar m a | |
-> (Maybe a -> a -> InspectMonad m TraceValue) | callback which receives initial value or |
-> STM m () |
Construct a trace output out of previous & new value of a TVar
. The
callback is called whenever an stm transaction which modifies the TVar
is
committed.
This is supported by IOSim
(and IOSimPOR
); IO
has a trivial instance.
The simplest example is:
traceTVar (Proxy @m) tvar (\_ -> TraceString . show)
Note that the interpretation of TraceValue
depends on the monad m
itself (see TraceValue
).
traceTVarIO :: MonadTraceSTM m => TVar m a -> (Maybe a -> a -> InspectMonad m TraceValue) -> m () Source #
debugTraceTVar :: forall (m :: Type -> Type) a proxy. (MonadTraceSTM m, Show a) => proxy m -> TVar m a -> STM m () Source #
debugTraceTVarIO :: (MonadTraceSTM m, Show a) => TVar m a -> m () Source #