Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- class (Monad m, Monad (STM m)) => MonadSTM (m :: Type -> Type) where
- type STM (m :: Type -> Type) = (stm :: Type -> Type) | stm -> m
- type TVar (m :: Type -> Type) :: Type -> Type
- type TMVar (m :: Type -> Type) :: Type -> Type
- type TQueue (m :: Type -> Type) :: Type -> Type
- type TBQueue (m :: Type -> Type) :: Type -> Type
- type TArray (m :: Type -> Type) :: Type -> Type -> Type
- type TSem (m :: Type -> Type)
- type TChan (m :: Type -> Type) :: Type -> Type
- atomically :: HasCallStack => STM m a -> m a
- newTVar :: a -> STM m (TVar m a)
- readTVar :: TVar m a -> STM m a
- writeTVar :: TVar m a -> a -> STM m ()
- retry :: STM m a
- orElse :: STM m a -> STM m a -> STM m a
- modifyTVar :: TVar m a -> (a -> a) -> STM m ()
- modifyTVar' :: TVar m a -> (a -> a) -> STM m ()
- stateTVar :: TVar m s -> (s -> (a, s)) -> STM m a
- swapTVar :: TVar m a -> a -> STM m a
- check :: Bool -> STM m ()
- newTMVar :: a -> STM m (TMVar m a)
- newEmptyTMVar :: STM m (TMVar m a)
- takeTMVar :: TMVar m a -> STM m a
- tryTakeTMVar :: TMVar m a -> STM m (Maybe a)
- putTMVar :: TMVar m a -> a -> STM m ()
- tryPutTMVar :: TMVar m a -> a -> STM m Bool
- readTMVar :: TMVar m a -> STM m a
- tryReadTMVar :: TMVar m a -> STM m (Maybe a)
- swapTMVar :: TMVar m a -> a -> STM m a
- writeTMVar :: TMVar m a -> a -> STM m ()
- isEmptyTMVar :: TMVar m a -> STM m Bool
- newTQueue :: STM m (TQueue m a)
- readTQueue :: TQueue m a -> STM m a
- tryReadTQueue :: TQueue m a -> STM m (Maybe a)
- peekTQueue :: TQueue m a -> STM m a
- tryPeekTQueue :: TQueue m a -> STM m (Maybe a)
- flushTQueue :: TQueue m a -> STM m [a]
- writeTQueue :: TQueue m a -> a -> STM m ()
- isEmptyTQueue :: TQueue m a -> STM m Bool
- unGetTQueue :: TQueue m a -> a -> STM m ()
- newTBQueue :: Natural -> STM m (TBQueue m a)
- readTBQueue :: TBQueue m a -> STM m a
- tryReadTBQueue :: TBQueue m a -> STM m (Maybe a)
- peekTBQueue :: TBQueue m a -> STM m a
- tryPeekTBQueue :: TBQueue m a -> STM m (Maybe a)
- flushTBQueue :: TBQueue m a -> STM m [a]
- writeTBQueue :: TBQueue m a -> a -> STM m ()
- lengthTBQueue :: TBQueue m a -> STM m Natural
- isEmptyTBQueue :: TBQueue m a -> STM m Bool
- isFullTBQueue :: TBQueue m a -> STM m Bool
- unGetTBQueue :: TBQueue m a -> a -> STM m ()
- newTSem :: Integer -> STM m (TSem m)
- waitTSem :: TSem m -> STM m ()
- signalTSem :: TSem m -> STM m ()
- signalTSemN :: Natural -> TSem m -> STM m ()
- newTChan :: STM m (TChan m a)
- newBroadcastTChan :: STM m (TChan m a)
- dupTChan :: TChan m a -> STM m (TChan m a)
- cloneTChan :: TChan m a -> STM m (TChan m a)
- readTChan :: TChan m a -> STM m a
- tryReadTChan :: TChan m a -> STM m (Maybe a)
- peekTChan :: TChan m a -> STM m a
- tryPeekTChan :: TChan m a -> STM m (Maybe a)
- writeTChan :: TChan m a -> a -> STM m ()
- unGetTChan :: TChan m a -> a -> STM m ()
- isEmptyTChan :: TChan m a -> STM m Bool
- newTVarIO :: a -> m (TVar m a)
- readTVarIO :: TVar m a -> m a
- newTMVarIO :: a -> m (TMVar m a)
- newEmptyTMVarIO :: m (TMVar m a)
- newTQueueIO :: m (TQueue m a)
- newTBQueueIO :: Natural -> m (TBQueue m a)
- newTChanIO :: m (TChan m a)
- newBroadcastTChanIO :: m (TChan m a)
- class MonadSTM m => MonadLabelledSTM (m :: Type -> Type) where
- labelTVar :: TVar m a -> String -> STM m ()
- labelTMVar :: TMVar m a -> String -> STM m ()
- labelTQueue :: TQueue m a -> String -> STM m ()
- labelTBQueue :: TBQueue m a -> String -> STM m ()
- labelTArray :: (Ix i, Show i) => TArray m i e -> String -> STM m ()
- labelTSem :: TSem m -> String -> STM m ()
- labelTChan :: TChan m a -> String -> STM m ()
- labelTVarIO :: TVar m a -> String -> m ()
- labelTMVarIO :: TMVar m a -> String -> m ()
- labelTQueueIO :: TQueue m a -> String -> m ()
- labelTBQueueIO :: TBQueue m a -> String -> m ()
- labelTArrayIO :: (Ix i, Show i) => TArray m i e -> String -> m ()
- labelTSemIO :: TSem m -> String -> m ()
- labelTChanIO :: TChan m a -> String -> m ()
- class (MonadSTM m, Monad (InspectMonad m)) => MonadInspectSTM (m :: Type -> Type) where
- type InspectMonad (m :: Type -> Type) :: Type -> Type
- inspectTVar :: proxy m -> TVar m a -> InspectMonad m a
- inspectTMVar :: proxy m -> TMVar m a -> InspectMonad m (Maybe a)
- data TraceValue where
- TraceValue :: forall tr. Typeable tr => {..} -> TraceValue
- pattern TraceDynamic :: () => Typeable tr => tr -> TraceValue
- pattern TraceString :: String -> TraceValue
- pattern DontTrace :: TraceValue
- class MonadInspectSTM m => MonadTraceSTM (m :: Type -> Type) where
- traceTVar :: proxy m -> TVar m a -> (Maybe a -> a -> InspectMonad m TraceValue) -> STM m ()
- traceTMVar :: proxy m -> TMVar m a -> (Maybe (Maybe a) -> Maybe a -> InspectMonad m TraceValue) -> STM m ()
- traceTQueue :: proxy m -> TQueue m a -> (Maybe [a] -> [a] -> InspectMonad m TraceValue) -> STM m ()
- traceTBQueue :: proxy m -> TBQueue m a -> (Maybe [a] -> [a] -> InspectMonad m TraceValue) -> STM m ()
- traceTSem :: proxy m -> TSem m -> (Maybe Integer -> Integer -> InspectMonad m TraceValue) -> STM m ()
- traceTVarIO :: TVar m a -> (Maybe a -> a -> InspectMonad m TraceValue) -> m ()
- traceTMVarIO :: TMVar m a -> (Maybe (Maybe a) -> Maybe a -> InspectMonad m TraceValue) -> m ()
- traceTQueueIO :: TQueue m a -> (Maybe [a] -> [a] -> InspectMonad m TraceValue) -> m ()
- traceTBQueueIO :: TBQueue m a -> (Maybe [a] -> [a] -> InspectMonad m TraceValue) -> m ()
- traceTSemIO :: TSem m -> (Maybe Integer -> Integer -> InspectMonad m TraceValue) -> m ()
- throwSTM :: forall (m :: Type -> Type) e a. (MonadSTM m, MonadThrow (STM m), Exception e) => e -> STM m a
- catchSTM :: forall (m :: Type -> Type) e a. (MonadSTM m, MonadCatch (STM m), Exception e) => STM m a -> (e -> STM m a) -> STM m a
- newtype TMVarDefault (m :: Type -> Type) a = TMVar (TVar m (Maybe a))
- newTMVarDefault :: forall (m :: Type -> Type) a. MonadSTM m => a -> STM m (TMVarDefault m a)
- newEmptyTMVarDefault :: forall (m :: Type -> Type) a. MonadSTM m => STM m (TMVarDefault m a)
- takeTMVarDefault :: forall (m :: Type -> Type) a. MonadSTM m => TMVarDefault m a -> STM m a
- tryTakeTMVarDefault :: forall (m :: Type -> Type) a. MonadSTM m => TMVarDefault m a -> STM m (Maybe a)
- putTMVarDefault :: forall (m :: Type -> Type) a. MonadSTM m => TMVarDefault m a -> a -> STM m ()
- tryPutTMVarDefault :: forall (m :: Type -> Type) a. MonadSTM m => TMVarDefault m a -> a -> STM m Bool
- readTMVarDefault :: forall (m :: Type -> Type) a. MonadSTM m => TMVarDefault m a -> STM m a
- tryReadTMVarDefault :: forall (m :: Type -> Type) a. MonadSTM m => TMVarDefault m a -> STM m (Maybe a)
- swapTMVarDefault :: forall (m :: Type -> Type) a. MonadSTM m => TMVarDefault m a -> a -> STM m a
- writeTMVarDefault :: forall (m :: Type -> Type) a. MonadSTM m => TMVarDefault m a -> a -> STM m ()
- isEmptyTMVarDefault :: forall (m :: Type -> Type) a. MonadSTM m => TMVarDefault m a -> STM m Bool
- labelTMVarDefault :: forall (m :: Type -> Type) a. MonadLabelledSTM m => TMVarDefault m a -> String -> STM m ()
- traceTMVarDefault :: forall (m :: Type -> Type) proxy a. MonadTraceSTM m => proxy m -> TMVarDefault m a -> (Maybe (Maybe a) -> Maybe a -> InspectMonad m TraceValue) -> STM m ()
- data TQueueDefault (m :: Type -> Type) a = TQueue !(TVar m [a]) !(TVar m [a])
- newTQueueDefault :: forall (m :: Type -> Type) a. MonadSTM m => STM m (TQueueDefault m a)
- writeTQueueDefault :: forall (m :: Type -> Type) a. MonadSTM m => TQueueDefault m a -> a -> STM m ()
- readTQueueDefault :: forall (m :: Type -> Type) a. MonadSTM m => TQueueDefault m a -> STM m a
- tryReadTQueueDefault :: forall (m :: Type -> Type) a. MonadSTM m => TQueueDefault m a -> STM m (Maybe a)
- isEmptyTQueueDefault :: forall (m :: Type -> Type) a. MonadSTM m => TQueueDefault m a -> STM m Bool
- peekTQueueDefault :: forall (m :: Type -> Type) a. MonadSTM m => TQueueDefault m a -> STM m a
- tryPeekTQueueDefault :: forall (m :: Type -> Type) a. MonadSTM m => TQueueDefault m a -> STM m (Maybe a)
- flushTQueueDefault :: forall (m :: Type -> Type) a. MonadSTM m => TQueueDefault m a -> STM m [a]
- unGetTQueueDefault :: forall (m :: Type -> Type) a. MonadSTM m => TQueueDefault m a -> a -> STM m ()
- labelTQueueDefault :: forall (m :: Type -> Type) a. MonadLabelledSTM m => TQueueDefault m a -> String -> STM m ()
- data TBQueueDefault (m :: Type -> Type) a = TBQueue !(TVar m Natural) !(TVar m [a]) !(TVar m Natural) !(TVar m [a]) !Natural
- newTBQueueDefault :: forall (m :: Type -> Type) a. MonadSTM m => Natural -> STM m (TBQueueDefault m a)
- writeTBQueueDefault :: forall (m :: Type -> Type) a. MonadSTM m => TBQueueDefault m a -> a -> STM m ()
- readTBQueueDefault :: forall (m :: Type -> Type) a. MonadSTM m => TBQueueDefault m a -> STM m a
- tryReadTBQueueDefault :: forall (m :: Type -> Type) a. MonadSTM m => TBQueueDefault m a -> STM m (Maybe a)
- peekTBQueueDefault :: forall (m :: Type -> Type) a. MonadSTM m => TBQueueDefault m a -> STM m a
- tryPeekTBQueueDefault :: forall (m :: Type -> Type) a. MonadSTM m => TBQueueDefault m a -> STM m (Maybe a)
- isEmptyTBQueueDefault :: forall (m :: Type -> Type) a. MonadSTM m => TBQueueDefault m a -> STM m Bool
- isFullTBQueueDefault :: forall (m :: Type -> Type) a. MonadSTM m => TBQueueDefault m a -> STM m Bool
- lengthTBQueueDefault :: forall (m :: Type -> Type) a. MonadSTM m => TBQueueDefault m a -> STM m Natural
- flushTBQueueDefault :: forall (m :: Type -> Type) a. MonadSTM m => TBQueueDefault m a -> STM m [a]
- unGetTBQueueDefault :: forall (m :: Type -> Type) a. MonadSTM m => TBQueueDefault m a -> a -> STM m ()
- labelTBQueueDefault :: forall (m :: Type -> Type) a. MonadLabelledSTM m => TBQueueDefault m a -> String -> STM m ()
- data TArrayDefault (m :: Type -> Type) i e = TArray (Array i (TVar m e))
- newtype TSemDefault (m :: Type -> Type) = TSem (TVar m Integer)
- newTSemDefault :: forall (m :: Type -> Type). MonadSTM m => Integer -> STM m (TSemDefault m)
- waitTSemDefault :: forall (m :: Type -> Type). MonadSTM m => TSemDefault m -> STM m ()
- signalTSemDefault :: forall (m :: Type -> Type). MonadSTM m => TSemDefault m -> STM m ()
- signalTSemNDefault :: forall (m :: Type -> Type). MonadSTM m => Natural -> TSemDefault m -> STM m ()
- labelTSemDefault :: forall (m :: Type -> Type). MonadLabelledSTM m => TSemDefault m -> String -> STM m ()
- data TChanDefault (m :: Type -> Type) a = TChan (TVar m (TVarList m a)) (TVar m (TVarList m a))
- newTChanDefault :: forall (m :: Type -> Type) a. MonadSTM m => STM m (TChanDefault m a)
- newBroadcastTChanDefault :: forall (m :: Type -> Type) a. MonadSTM m => STM m (TChanDefault m a)
- writeTChanDefault :: forall (m :: Type -> Type) a. MonadSTM m => TChanDefault m a -> a -> STM m ()
- readTChanDefault :: forall (m :: Type -> Type) a. MonadSTM m => TChanDefault m a -> STM m a
- tryReadTChanDefault :: forall (m :: Type -> Type) a. MonadSTM m => TChanDefault m a -> STM m (Maybe a)
- peekTChanDefault :: forall (m :: Type -> Type) a. MonadSTM m => TChanDefault m a -> STM m a
- tryPeekTChanDefault :: forall (m :: Type -> Type) a. MonadSTM m => TChanDefault m a -> STM m (Maybe a)
- dupTChanDefault :: forall (m :: Type -> Type) a. MonadSTM m => TChanDefault m a -> STM m (TChanDefault m a)
- unGetTChanDefault :: forall (m :: Type -> Type) a. MonadSTM m => TChanDefault m a -> a -> STM m ()
- isEmptyTChanDefault :: forall (m :: Type -> Type) a. MonadSTM m => TChanDefault m a -> STM m Bool
- cloneTChanDefault :: forall (m :: Type -> Type) a. MonadSTM m => TChanDefault m a -> STM m (TChanDefault m a)
- labelTChanDefault :: forall (m :: Type -> Type) a. MonadLabelledSTM m => TChanDefault m a -> String -> STM 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 ()
- debugTraceTMVar :: forall (m :: Type -> Type) a proxy. (MonadTraceSTM m, Show a) => proxy m -> TMVar m a -> STM m ()
- debugTraceTMVarIO :: (Show a, MonadTraceSTM m) => TMVar m a -> m ()
Documentation
class (Monad m, Monad (STM m)) => MonadSTM (m :: Type -> Type) where Source #
The STM primitives parametrised by a monad m
.
atomically, newTVar, readTVar, writeTVar, retry, orElse, newTMVar, newEmptyTMVar, takeTMVar, tryTakeTMVar, putTMVar, tryPutTMVar, readTMVar, tryReadTMVar, swapTMVar, writeTMVar, isEmptyTMVar, newTQueue, readTQueue, tryReadTQueue, peekTQueue, tryPeekTQueue, flushTQueue, writeTQueue, isEmptyTQueue, unGetTQueue, newTBQueue, readTBQueue, tryReadTBQueue, peekTBQueue, tryPeekTBQueue, flushTBQueue, writeTBQueue, lengthTBQueue, isEmptyTBQueue, isFullTBQueue, unGetTBQueue, newTSem, waitTSem, signalTSem, signalTSemN, newTChan, newBroadcastTChan, dupTChan, cloneTChan, readTChan, tryReadTChan, peekTChan, tryPeekTChan, writeTChan, unGetTChan, isEmptyTChan
type STM (m :: Type -> Type) = (stm :: Type -> Type) | stm -> m Source #
The STM monad.
type TVar (m :: Type -> Type) :: Type -> Type Source #
type TMVar (m :: Type -> Type) :: Type -> Type Source #
type TQueue (m :: Type -> Type) :: Type -> Type Source #
type TBQueue (m :: Type -> Type) :: Type -> Type Source #
type TArray (m :: Type -> Type) :: Type -> Type -> Type Source #
atomically :: HasCallStack => STM m a -> m a Source #
Atomically run an STM computation.
See atomically
.
newTVar :: a -> STM m (TVar m a) Source #
readTVar :: TVar m a -> STM m a Source #
writeTVar :: TVar m a -> a -> STM m () Source #
See retry
.
orElse :: STM m a -> STM m a -> STM m a Source #
See orElse
.
modifyTVar :: TVar m a -> (a -> a) -> STM m () Source #
modifyTVar' :: TVar m a -> (a -> a) -> STM m () Source #
stateTVar :: TVar m s -> (s -> (a, s)) -> STM m a Source #
@since io-classes-0.2.0.0
swapTVar :: TVar m a -> a -> STM m a Source #
check :: Bool -> STM m () Source #
See check
.
newTMVar :: a -> STM m (TMVar m a) Source #
newEmptyTMVar :: STM m (TMVar m a) Source #
takeTMVar :: TMVar m a -> STM m a Source #
tryTakeTMVar :: TMVar m a -> STM m (Maybe a) Source #
putTMVar :: TMVar m a -> a -> STM m () Source #
tryPutTMVar :: TMVar m a -> a -> STM m Bool Source #
readTMVar :: TMVar m a -> STM m a Source #
tryReadTMVar :: TMVar m a -> STM m (Maybe a) Source #
swapTMVar :: TMVar m a -> a -> STM m a Source #
writeTMVar :: TMVar m a -> a -> STM m () Source #
isEmptyTMVar :: TMVar m a -> STM m Bool Source #
newTQueue :: STM m (TQueue m a) Source #
readTQueue :: TQueue m a -> STM m a Source #
tryReadTQueue :: TQueue m a -> STM m (Maybe a) Source #
peekTQueue :: TQueue m a -> STM m a Source #
tryPeekTQueue :: TQueue m a -> STM m (Maybe a) Source #
flushTQueue :: TQueue m a -> STM m [a] Source #
writeTQueue :: TQueue m a -> a -> STM m () Source #
isEmptyTQueue :: TQueue m a -> STM m Bool Source #
unGetTQueue :: TQueue m a -> a -> STM m () Source #
newTBQueue :: Natural -> STM m (TBQueue m a) Source #
readTBQueue :: TBQueue m a -> STM m a Source #
tryReadTBQueue :: TBQueue m a -> STM m (Maybe a) Source #
peekTBQueue :: TBQueue m a -> STM m a Source #
tryPeekTBQueue :: TBQueue m a -> STM m (Maybe a) Source #
flushTBQueue :: TBQueue m a -> STM m [a] Source #
writeTBQueue :: TBQueue m a -> a -> STM m () Source #
lengthTBQueue :: TBQueue m a -> STM m Natural Source #
Since: 0.2.0.0
isEmptyTBQueue :: TBQueue m a -> STM m Bool Source #
isFullTBQueue :: TBQueue m a -> STM m Bool Source #
unGetTBQueue :: TBQueue m a -> a -> STM m () Source #
newTSem :: Integer -> STM m (TSem m) Source #
waitTSem :: TSem m -> STM m () Source #
signalTSem :: TSem m -> STM m () Source #
signalTSemN :: Natural -> TSem m -> STM m () Source #
newTChan :: STM m (TChan m a) Source #
newBroadcastTChan :: STM m (TChan m a) Source #
dupTChan :: TChan m a -> STM m (TChan m a) Source #
cloneTChan :: TChan m a -> STM m (TChan m a) Source #
readTChan :: TChan m a -> STM m a Source #
tryReadTChan :: TChan m a -> STM m (Maybe a) Source #
peekTChan :: TChan m a -> STM m a Source #
tryPeekTChan :: TChan m a -> STM m (Maybe a) Source #
writeTChan :: TChan m a -> a -> STM m () Source #
unGetTChan :: TChan m a -> a -> STM m () Source #
isEmptyTChan :: TChan m a -> STM m Bool Source #
newTVarIO :: a -> m (TVar m a) Source #
readTVarIO :: TVar m a -> m a Source #
newTMVarIO :: a -> m (TMVar m a) Source #
newEmptyTMVarIO :: m (TMVar m a) Source #
newTQueueIO :: m (TQueue m a) Source #
newTBQueueIO :: Natural -> m (TBQueue m a) Source #
newTChanIO :: m (TChan m a) Source #
newBroadcastTChanIO :: m (TChan m a) Source #
Instances
class MonadSTM m => MonadLabelledSTM (m :: Type -> Type) where Source #
Labelled TVar
s & friends.
The IO
instances is no-op, the IOSim
instance enhances simulation trace.
This is very useful when analysing low lever concurrency issues (e.g.
deadlocks, livelocks etc).
labelTVar :: TVar m a -> String -> STM m () Source #
Name a TVar
.
labelTMVar :: TMVar m a -> String -> STM m () Source #
default labelTMVar :: TMVar m ~ TMVarDefault m => TMVar m a -> String -> STM m () Source #
labelTQueue :: TQueue m a -> String -> STM m () Source #
default labelTQueue :: TQueue m ~ TQueueDefault m => TQueue m a -> String -> STM m () Source #
labelTBQueue :: TBQueue m a -> String -> STM m () Source #
default labelTBQueue :: TBQueue m ~ TBQueueDefault m => TBQueue m a -> String -> STM m () Source #
labelTArray :: (Ix i, Show i) => TArray m i e -> String -> STM m () Source #
default labelTArray :: (TArray m ~ TArrayDefault m, Ix i, Show i) => TArray m i e -> String -> STM m () Source #
labelTSem :: TSem m -> String -> STM m () Source #
labelTChan :: TChan m a -> String -> STM m () Source #
default labelTChan :: TChan m ~ TChanDefault m => TChan m a -> String -> STM m () Source #
labelTVarIO :: TVar m a -> String -> m () Source #
default labelTVarIO :: TVar m a -> String -> m () Source #
labelTMVarIO :: TMVar m a -> String -> m () Source #
default labelTMVarIO :: TMVar m a -> String -> m () Source #
labelTQueueIO :: TQueue m a -> String -> m () Source #
default labelTQueueIO :: TQueue m a -> String -> m () Source #
labelTBQueueIO :: TBQueue m a -> String -> m () Source #
default labelTBQueueIO :: TBQueue m a -> String -> m () Source #
labelTArrayIO :: (Ix i, Show i) => TArray m i e -> String -> m () Source #
labelTSemIO :: TSem m -> String -> m () Source #
default labelTSemIO :: TSem m -> String -> m () Source #
labelTChanIO :: TChan m a -> String -> m () Source #
default labelTChanIO :: TChan m a -> String -> m () Source #
Instances
MonadLabelledSTM IO Source # | noop instance |
Defined in Control.Monad.Class.MonadSTM.Internal labelTVar :: TVar IO a -> String -> STM IO () Source # labelTMVar :: TMVar IO a -> String -> STM IO () Source # labelTQueue :: TQueue IO a -> String -> STM IO () Source # labelTBQueue :: TBQueue IO a -> String -> STM IO () Source # labelTArray :: (Ix i, Show i) => TArray IO i e -> String -> STM IO () Source # labelTSem :: TSem IO -> String -> STM IO () Source # labelTChan :: TChan IO a -> String -> STM IO () Source # labelTVarIO :: TVar IO a -> String -> IO () Source # labelTMVarIO :: TMVar IO a -> String -> IO () Source # labelTQueueIO :: TQueue IO a -> String -> IO () Source # labelTBQueueIO :: TBQueue IO a -> String -> IO () Source # labelTArrayIO :: (Ix i, Show i) => TArray IO i e -> String -> IO () Source # |
class (MonadSTM m, Monad (InspectMonad m)) => MonadInspectSTM (m :: Type -> Type) where Source #
This type class is indented for
'io-sim', where one might want
to access a TVar
in the underlying ST
monad.
inspectTVar :: proxy m -> TVar m a -> InspectMonad m a Source #
Return the value of a TVar
as an InspectMonad
computation.
inspectTVar
is useful if the value of a TVar
observed by traceTVar
contains other TVar
s.
inspectTMVar :: proxy m -> TMVar m a -> InspectMonad m (Maybe a) Source #
Return the value of a TMVar
as an InspectMonad
computation.
Instances
MonadInspectSTM IO Source # | |||||
Defined in Control.Monad.Class.MonadSTM.Internal
inspectTVar :: proxy IO -> TVar IO a -> InspectMonad IO a Source # inspectTMVar :: proxy IO -> TMVar IO a -> InspectMonad IO (Maybe a) Source # | |||||
MonadInspectSTM m => MonadInspectSTM (ReaderT r m) Source # | |||||
Defined in Control.Monad.Class.MonadSTM.Internal
inspectTVar :: proxy (ReaderT r m) -> TVar (ReaderT r m) a -> InspectMonad (ReaderT r m) a Source # inspectTMVar :: proxy (ReaderT r m) -> TMVar (ReaderT r m) a -> InspectMonad (ReaderT r m) (Maybe a) Source # |
data TraceValue where Source #
A GADT which instructs how to trace the value. The traceDynamic
will
use dynamic tracing, e.g. "Control.Monad.IOSim.traceM"; while traceString
will be traced with EventSay
. The IOSim
s dynamic tracing allows to
recover the value from the simulation trace (see
"Control.Monad.IOSim.selectTraceEventsDynamic").
TraceValue | |
|
pattern TraceDynamic :: () => Typeable tr => tr -> TraceValue | Use only a dynamic tracer. |
pattern TraceString :: String -> TraceValue | Use only string tracing. |
pattern DontTrace :: TraceValue | Do not trace the value. |
class MonadInspectSTM m => MonadTraceSTM (m :: Type -> Type) where Source #
MonadTraceSTM
allows to trace values of stm variables when stm
transaction is committed. This allows to verify invariants when a variable
is committed.
:: 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
).
traceTMVar :: proxy m -> TMVar m a -> (Maybe (Maybe a) -> Maybe a -> InspectMonad m TraceValue) -> STM m () Source #
default traceTMVar :: TMVar m a ~ TMVarDefault m a => proxy m -> TMVar m a -> (Maybe (Maybe a) -> Maybe a -> InspectMonad m TraceValue) -> STM m () Source #
traceTQueue :: proxy m -> TQueue m a -> (Maybe [a] -> [a] -> InspectMonad m TraceValue) -> STM m () Source #
traceTBQueue :: proxy m -> TBQueue m a -> (Maybe [a] -> [a] -> InspectMonad m TraceValue) -> STM m () Source #
traceTSem :: proxy m -> TSem m -> (Maybe Integer -> Integer -> InspectMonad m TraceValue) -> STM m () Source #
default traceTSem :: TSem m ~ TSemDefault m => proxy m -> TSem m -> (Maybe Integer -> Integer -> InspectMonad m TraceValue) -> STM m () Source #
traceTVarIO :: TVar m a -> (Maybe a -> a -> InspectMonad m TraceValue) -> m () Source #
default traceTVarIO :: TVar m a -> (Maybe a -> a -> InspectMonad m TraceValue) -> m () Source #
traceTMVarIO :: TMVar m a -> (Maybe (Maybe a) -> Maybe a -> InspectMonad m TraceValue) -> m () Source #
default traceTMVarIO :: TMVar m a -> (Maybe (Maybe a) -> Maybe a -> InspectMonad m TraceValue) -> m () Source #
traceTQueueIO :: TQueue m a -> (Maybe [a] -> [a] -> InspectMonad m TraceValue) -> m () Source #
default traceTQueueIO :: TQueue m a -> (Maybe [a] -> [a] -> InspectMonad m TraceValue) -> m () Source #
traceTBQueueIO :: TBQueue m a -> (Maybe [a] -> [a] -> InspectMonad m TraceValue) -> m () Source #
default traceTBQueueIO :: TBQueue m a -> (Maybe [a] -> [a] -> InspectMonad m TraceValue) -> m () Source #
traceTSemIO :: TSem m -> (Maybe Integer -> Integer -> InspectMonad m TraceValue) -> m () Source #
default traceTSemIO :: TSem m -> (Maybe Integer -> Integer -> InspectMonad m TraceValue) -> m () Source #
Instances
MonadTraceSTM IO Source # | noop instance |
Defined in Control.Monad.Class.MonadSTM.Internal traceTVar :: proxy IO -> TVar IO a -> (Maybe a -> a -> InspectMonad IO TraceValue) -> STM IO () Source # traceTMVar :: proxy IO -> TMVar IO a -> (Maybe (Maybe a) -> Maybe a -> InspectMonad IO TraceValue) -> STM IO () Source # traceTQueue :: proxy IO -> TQueue IO a -> (Maybe [a] -> [a] -> InspectMonad IO TraceValue) -> STM IO () Source # traceTBQueue :: proxy IO -> TBQueue IO a -> (Maybe [a] -> [a] -> InspectMonad IO TraceValue) -> STM IO () Source # traceTSem :: proxy IO -> TSem IO -> (Maybe Integer -> Integer -> InspectMonad IO TraceValue) -> STM IO () Source # traceTVarIO :: TVar IO a -> (Maybe a -> a -> InspectMonad IO TraceValue) -> IO () Source # traceTMVarIO :: TMVar IO a -> (Maybe (Maybe a) -> Maybe a -> InspectMonad IO TraceValue) -> IO () Source # traceTQueueIO :: TQueue IO a -> (Maybe [a] -> [a] -> InspectMonad IO TraceValue) -> IO () Source # traceTBQueueIO :: TBQueue IO a -> (Maybe [a] -> [a] -> InspectMonad IO TraceValue) -> IO () Source # traceTSemIO :: TSem IO -> (Maybe Integer -> Integer -> InspectMonad IO TraceValue) -> IO () Source # | |
MonadTraceSTM m => MonadTraceSTM (ReaderT r m) Source # | |
Defined in Control.Monad.Class.MonadSTM.Internal traceTVar :: proxy (ReaderT r m) -> TVar (ReaderT r m) a -> (Maybe a -> a -> InspectMonad (ReaderT r m) TraceValue) -> STM (ReaderT r m) () Source # traceTMVar :: proxy (ReaderT r m) -> TMVar (ReaderT r m) a -> (Maybe (Maybe a) -> Maybe a -> InspectMonad (ReaderT r m) TraceValue) -> STM (ReaderT r m) () Source # traceTQueue :: proxy (ReaderT r m) -> TQueue (ReaderT r m) a -> (Maybe [a] -> [a] -> InspectMonad (ReaderT r m) TraceValue) -> STM (ReaderT r m) () Source # traceTBQueue :: proxy (ReaderT r m) -> TBQueue (ReaderT r m) a -> (Maybe [a] -> [a] -> InspectMonad (ReaderT r m) TraceValue) -> STM (ReaderT r m) () Source # traceTSem :: proxy (ReaderT r m) -> TSem (ReaderT r m) -> (Maybe Integer -> Integer -> InspectMonad (ReaderT r m) TraceValue) -> STM (ReaderT r m) () Source # traceTVarIO :: TVar (ReaderT r m) a -> (Maybe a -> a -> InspectMonad (ReaderT r m) TraceValue) -> ReaderT r m () Source # traceTMVarIO :: TMVar (ReaderT r m) a -> (Maybe (Maybe a) -> Maybe a -> InspectMonad (ReaderT r m) TraceValue) -> ReaderT r m () Source # traceTQueueIO :: TQueue (ReaderT r m) a -> (Maybe [a] -> [a] -> InspectMonad (ReaderT r m) TraceValue) -> ReaderT r m () Source # traceTBQueueIO :: TBQueue (ReaderT r m) a -> (Maybe [a] -> [a] -> InspectMonad (ReaderT r m) TraceValue) -> ReaderT r m () Source # traceTSemIO :: TSem (ReaderT r m) -> (Maybe Integer -> Integer -> InspectMonad (ReaderT r m) TraceValue) -> ReaderT r m () Source # |
MonadThrow aliases
throwSTM :: forall (m :: Type -> Type) e a. (MonadSTM m, MonadThrow (STM m), Exception e) => e -> STM m a Source #
throwIO
specialised to stm
monad.
catchSTM :: forall (m :: Type -> Type) e a. (MonadSTM m, MonadCatch (STM m), Exception e) => STM m a -> (e -> STM m a) -> STM m a Source #
catch
specialized for an stm
monad.
Default implementations
The default implementations are based on a TVar
defined in the class. They
are tailored towards IOSim
rather than instances which would like to derive
from IO
or monad transformers.
newTMVarDefault :: forall (m :: Type -> Type) a. MonadSTM m => a -> STM m (TMVarDefault m a) Source #
newEmptyTMVarDefault :: forall (m :: Type -> Type) a. MonadSTM m => STM m (TMVarDefault m a) Source #
takeTMVarDefault :: forall (m :: Type -> Type) a. MonadSTM m => TMVarDefault m a -> STM m a Source #
tryTakeTMVarDefault :: forall (m :: Type -> Type) a. MonadSTM m => TMVarDefault m a -> STM m (Maybe a) Source #
putTMVarDefault :: forall (m :: Type -> Type) a. MonadSTM m => TMVarDefault m a -> a -> STM m () Source #
tryPutTMVarDefault :: forall (m :: Type -> Type) a. MonadSTM m => TMVarDefault m a -> a -> STM m Bool Source #
readTMVarDefault :: forall (m :: Type -> Type) a. MonadSTM m => TMVarDefault m a -> STM m a Source #
tryReadTMVarDefault :: forall (m :: Type -> Type) a. MonadSTM m => TMVarDefault m a -> STM m (Maybe a) Source #
swapTMVarDefault :: forall (m :: Type -> Type) a. MonadSTM m => TMVarDefault m a -> a -> STM m a Source #
writeTMVarDefault :: forall (m :: Type -> Type) a. MonadSTM m => TMVarDefault m a -> a -> STM m () Source #
isEmptyTMVarDefault :: forall (m :: Type -> Type) a. MonadSTM m => TMVarDefault m a -> STM m Bool Source #
labelTMVarDefault :: forall (m :: Type -> Type) a. MonadLabelledSTM m => TMVarDefault m a -> String -> STM m () Source #
traceTMVarDefault :: forall (m :: Type -> Type) proxy a. MonadTraceSTM m => proxy m -> TMVarDefault m a -> (Maybe (Maybe a) -> Maybe a -> InspectMonad m TraceValue) -> STM m () Source #
Default TQueue
implementation
newTQueueDefault :: forall (m :: Type -> Type) a. MonadSTM m => STM m (TQueueDefault m a) Source #
writeTQueueDefault :: forall (m :: Type -> Type) a. MonadSTM m => TQueueDefault m a -> a -> STM m () Source #
readTQueueDefault :: forall (m :: Type -> Type) a. MonadSTM m => TQueueDefault m a -> STM m a Source #
tryReadTQueueDefault :: forall (m :: Type -> Type) a. MonadSTM m => TQueueDefault m a -> STM m (Maybe a) Source #
isEmptyTQueueDefault :: forall (m :: Type -> Type) a. MonadSTM m => TQueueDefault m a -> STM m Bool Source #
peekTQueueDefault :: forall (m :: Type -> Type) a. MonadSTM m => TQueueDefault m a -> STM m a Source #
tryPeekTQueueDefault :: forall (m :: Type -> Type) a. MonadSTM m => TQueueDefault m a -> STM m (Maybe a) Source #
flushTQueueDefault :: forall (m :: Type -> Type) a. MonadSTM m => TQueueDefault m a -> STM m [a] Source #
unGetTQueueDefault :: forall (m :: Type -> Type) a. MonadSTM m => TQueueDefault m a -> a -> STM m () Source #
labelTQueueDefault :: forall (m :: Type -> Type) a. MonadLabelledSTM m => TQueueDefault m a -> String -> STM m () Source #
Default TBQueue
implementation
data TBQueueDefault (m :: Type -> Type) a Source #
newTBQueueDefault :: forall (m :: Type -> Type) a. MonadSTM m => Natural -> STM m (TBQueueDefault m a) Source #
writeTBQueueDefault :: forall (m :: Type -> Type) a. MonadSTM m => TBQueueDefault m a -> a -> STM m () Source #
readTBQueueDefault :: forall (m :: Type -> Type) a. MonadSTM m => TBQueueDefault m a -> STM m a Source #
tryReadTBQueueDefault :: forall (m :: Type -> Type) a. MonadSTM m => TBQueueDefault m a -> STM m (Maybe a) Source #
peekTBQueueDefault :: forall (m :: Type -> Type) a. MonadSTM m => TBQueueDefault m a -> STM m a Source #
tryPeekTBQueueDefault :: forall (m :: Type -> Type) a. MonadSTM m => TBQueueDefault m a -> STM m (Maybe a) Source #
isEmptyTBQueueDefault :: forall (m :: Type -> Type) a. MonadSTM m => TBQueueDefault m a -> STM m Bool Source #
isFullTBQueueDefault :: forall (m :: Type -> Type) a. MonadSTM m => TBQueueDefault m a -> STM m Bool Source #
lengthTBQueueDefault :: forall (m :: Type -> Type) a. MonadSTM m => TBQueueDefault m a -> STM m Natural Source #
flushTBQueueDefault :: forall (m :: Type -> Type) a. MonadSTM m => TBQueueDefault m a -> STM m [a] Source #
unGetTBQueueDefault :: forall (m :: Type -> Type) a. MonadSTM m => TBQueueDefault m a -> a -> STM m () Source #
labelTBQueueDefault :: forall (m :: Type -> Type) a. MonadLabelledSTM m => TBQueueDefault m a -> String -> STM m () Source #
Default TArray
implementation
data TArrayDefault (m :: Type -> Type) i e Source #
Default implementation of TArray
.
Instances
(Monad stm, MonadSTM m, stm ~ STM m) => MArray (TArrayDefault m) e stm Source # | |
Defined in Control.Monad.Class.MonadSTM.Internal getBounds :: Ix i => TArrayDefault m i e -> stm (i, i) # getNumElements :: Ix i => TArrayDefault m i e -> stm Int # newArray :: Ix i => (i, i) -> e -> stm (TArrayDefault m i e) # newArray_ :: Ix i => (i, i) -> stm (TArrayDefault m i e) # unsafeNewArray_ :: Ix i => (i, i) -> stm (TArrayDefault m i e) # unsafeRead :: Ix i => TArrayDefault m i e -> Int -> stm e # unsafeWrite :: Ix i => TArrayDefault m i e -> Int -> e -> stm () # | |
(Eq (TVar m e), Ix i) => Eq (TArrayDefault m i e) Source # | |
Defined in Control.Monad.Class.MonadSTM.Internal (==) :: TArrayDefault m i e -> TArrayDefault m i e -> Bool # (/=) :: TArrayDefault m i e -> TArrayDefault m i e -> Bool # |
Default TSem
implementation
newTSemDefault :: forall (m :: Type -> Type). MonadSTM m => Integer -> STM m (TSemDefault m) Source #
waitTSemDefault :: forall (m :: Type -> Type). MonadSTM m => TSemDefault m -> STM m () Source #
signalTSemDefault :: forall (m :: Type -> Type). MonadSTM m => TSemDefault m -> STM m () Source #
signalTSemNDefault :: forall (m :: Type -> Type). MonadSTM m => Natural -> TSemDefault m -> STM m () Source #
labelTSemDefault :: forall (m :: Type -> Type). MonadLabelledSTM m => TSemDefault m -> String -> STM m () Source #
Default TChan
implementation
data TChanDefault (m :: Type -> Type) a Source #
newTChanDefault :: forall (m :: Type -> Type) a. MonadSTM m => STM m (TChanDefault m a) Source #
newBroadcastTChanDefault :: forall (m :: Type -> Type) a. MonadSTM m => STM m (TChanDefault m a) Source #
writeTChanDefault :: forall (m :: Type -> Type) a. MonadSTM m => TChanDefault m a -> a -> STM m () Source #
readTChanDefault :: forall (m :: Type -> Type) a. MonadSTM m => TChanDefault m a -> STM m a Source #
tryReadTChanDefault :: forall (m :: Type -> Type) a. MonadSTM m => TChanDefault m a -> STM m (Maybe a) Source #
peekTChanDefault :: forall (m :: Type -> Type) a. MonadSTM m => TChanDefault m a -> STM m a Source #
tryPeekTChanDefault :: forall (m :: Type -> Type) a. MonadSTM m => TChanDefault m a -> STM m (Maybe a) Source #
dupTChanDefault :: forall (m :: Type -> Type) a. MonadSTM m => TChanDefault m a -> STM m (TChanDefault m a) Source #
unGetTChanDefault :: forall (m :: Type -> Type) a. MonadSTM m => TChanDefault m a -> a -> STM m () Source #
isEmptyTChanDefault :: forall (m :: Type -> Type) a. MonadSTM m => TChanDefault m a -> STM m Bool Source #
cloneTChanDefault :: forall (m :: Type -> Type) a. MonadSTM m => TChanDefault m a -> STM m (TChanDefault m a) Source #
labelTChanDefault :: forall (m :: Type -> Type) a. MonadLabelledSTM m => TChanDefault m a -> String -> STM m () Source #
Trace tvar and tmvar
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 #
debugTraceTMVar :: forall (m :: Type -> Type) a proxy. (MonadTraceSTM m, Show a) => proxy m -> TMVar m a -> STM m () Source #
debugTraceTMVarIO :: (Show a, MonadTraceSTM m) => TMVar m a -> m () Source #