Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- class (Monad m, Monad (STM m)) => MonadSTM m where
- type STM m = (stm :: Type -> Type) | stm -> m
- type TVar m :: Type -> Type
- type TMVar m :: Type -> Type
- type TQueue m :: Type -> Type
- type TBQueue m :: Type -> Type
- type TArray m :: Type -> Type -> Type
- type TSem m :: Type
- type TChan m :: 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 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 where
- type InspectMonad m :: 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 :: () => forall tr. Typeable tr => tr -> TraceValue
- pattern TraceString :: String -> TraceValue
- pattern DontTrace :: TraceValue
- class MonadInspectSTM m => MonadTraceSTM m 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 :: (MonadSTM m, MonadThrow (STM m), Exception e) => e -> STM m a
- catchSTM :: (MonadSTM m, MonadCatch (STM m), Exception e) => STM m a -> (e -> STM m a) -> STM m a
- newtype TMVarDefault m a = TMVar (TVar m (Maybe a))
- newTMVarDefault :: MonadSTM m => a -> STM m (TMVarDefault m a)
- newEmptyTMVarDefault :: MonadSTM m => STM m (TMVarDefault m a)
- takeTMVarDefault :: MonadSTM m => TMVarDefault m a -> STM m a
- tryTakeTMVarDefault :: MonadSTM m => TMVarDefault m a -> STM m (Maybe a)
- putTMVarDefault :: MonadSTM m => TMVarDefault m a -> a -> STM m ()
- tryPutTMVarDefault :: MonadSTM m => TMVarDefault m a -> a -> STM m Bool
- readTMVarDefault :: MonadSTM m => TMVarDefault m a -> STM m a
- tryReadTMVarDefault :: MonadSTM m => TMVarDefault m a -> STM m (Maybe a)
- swapTMVarDefault :: MonadSTM m => TMVarDefault m a -> a -> STM m a
- writeTMVarDefault :: MonadSTM m => TMVarDefault m a -> a -> STM m ()
- isEmptyTMVarDefault :: MonadSTM m => TMVarDefault m a -> STM m Bool
- labelTMVarDefault :: MonadLabelledSTM m => TMVarDefault m a -> String -> STM m ()
- traceTMVarDefault :: MonadTraceSTM m => proxy m -> TMVarDefault m a -> (Maybe (Maybe a) -> Maybe a -> InspectMonad m TraceValue) -> STM m ()
- data TQueueDefault m a = TQueue !(TVar m [a]) !(TVar m [a])
- newTQueueDefault :: MonadSTM m => STM m (TQueueDefault m a)
- writeTQueueDefault :: MonadSTM m => TQueueDefault m a -> a -> STM m ()
- readTQueueDefault :: MonadSTM m => TQueueDefault m a -> STM m a
- tryReadTQueueDefault :: MonadSTM m => TQueueDefault m a -> STM m (Maybe a)
- isEmptyTQueueDefault :: MonadSTM m => TQueueDefault m a -> STM m Bool
- peekTQueueDefault :: MonadSTM m => TQueueDefault m a -> STM m a
- tryPeekTQueueDefault :: MonadSTM m => TQueueDefault m a -> STM m (Maybe a)
- flushTQueueDefault :: MonadSTM m => TQueueDefault m a -> STM m [a]
- unGetTQueueDefault :: MonadSTM m => TQueueDefault m a -> a -> STM m ()
- labelTQueueDefault :: MonadLabelledSTM m => TQueueDefault m a -> String -> STM m ()
- data TBQueueDefault m a = TBQueue !(TVar m Natural) !(TVar m [a]) !(TVar m Natural) !(TVar m [a]) !Natural
- newTBQueueDefault :: MonadSTM m => Natural -> STM m (TBQueueDefault m a)
- writeTBQueueDefault :: MonadSTM m => TBQueueDefault m a -> a -> STM m ()
- readTBQueueDefault :: MonadSTM m => TBQueueDefault m a -> STM m a
- tryReadTBQueueDefault :: MonadSTM m => TBQueueDefault m a -> STM m (Maybe a)
- peekTBQueueDefault :: MonadSTM m => TBQueueDefault m a -> STM m a
- tryPeekTBQueueDefault :: MonadSTM m => TBQueueDefault m a -> STM m (Maybe a)
- isEmptyTBQueueDefault :: MonadSTM m => TBQueueDefault m a -> STM m Bool
- isFullTBQueueDefault :: MonadSTM m => TBQueueDefault m a -> STM m Bool
- lengthTBQueueDefault :: MonadSTM m => TBQueueDefault m a -> STM m Natural
- flushTBQueueDefault :: MonadSTM m => TBQueueDefault m a -> STM m [a]
- unGetTBQueueDefault :: MonadSTM m => TBQueueDefault m a -> a -> STM m ()
- labelTBQueueDefault :: MonadLabelledSTM m => TBQueueDefault m a -> String -> STM m ()
- data TArrayDefault m i e = TArray (Array i (TVar m e))
- newtype TSemDefault m = TSem (TVar m Integer)
- newTSemDefault :: MonadSTM m => Integer -> STM m (TSemDefault m)
- waitTSemDefault :: MonadSTM m => TSemDefault m -> STM m ()
- signalTSemDefault :: MonadSTM m => TSemDefault m -> STM m ()
- signalTSemNDefault :: MonadSTM m => Natural -> TSemDefault m -> STM m ()
- labelTSemDefault :: MonadLabelledSTM m => TSemDefault m -> String -> STM m ()
- data TChanDefault m a = TChan (TVar m (TVarList m a)) (TVar m (TVarList m a))
- newTChanDefault :: MonadSTM m => STM m (TChanDefault m a)
- newBroadcastTChanDefault :: MonadSTM m => STM m (TChanDefault m a)
- writeTChanDefault :: MonadSTM m => TChanDefault m a -> a -> STM m ()
- readTChanDefault :: MonadSTM m => TChanDefault m a -> STM m a
- tryReadTChanDefault :: MonadSTM m => TChanDefault m a -> STM m (Maybe a)
- peekTChanDefault :: MonadSTM m => TChanDefault m a -> STM m a
- tryPeekTChanDefault :: MonadSTM m => TChanDefault m a -> STM m (Maybe a)
- dupTChanDefault :: MonadSTM m => TChanDefault m a -> STM m (TChanDefault m a)
- unGetTChanDefault :: MonadSTM m => TChanDefault m a -> a -> STM m ()
- isEmptyTChanDefault :: MonadSTM m => TChanDefault m a -> STM m Bool
- cloneTChanDefault :: MonadSTM m => TChanDefault m a -> STM m (TChanDefault m a)
- labelTChanDefault :: MonadLabelledSTM m => TChanDefault m a -> String -> STM m ()
Documentation
class (Monad m, Monad (STM m)) => MonadSTM m 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 = (stm :: Type -> Type) | stm -> m Source #
The STM monad.
type TVar m :: Type -> Type Source #
type TMVar m :: Type -> Type Source #
type TQueue m :: Type -> Type Source #
type TBQueue m :: 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 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 where Source #
This type class is indented for
'io-sim', where one might want
to access a TVar
in the underlying ST
monad.
type InspectMonad m :: Type -> Type Source #
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 MonadSTM
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 # |
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 :: () => forall tr. 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 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
MonadThrow aliases
throwSTM :: (MonadSTM m, MonadThrow (STM m), Exception e) => e -> STM m a Source #
throwIO
specialised to stm
monad.
catchSTM :: (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 :: MonadSTM m => a -> STM m (TMVarDefault m a) Source #
newEmptyTMVarDefault :: MonadSTM m => STM m (TMVarDefault m a) Source #
takeTMVarDefault :: MonadSTM m => TMVarDefault m a -> STM m a Source #
tryTakeTMVarDefault :: MonadSTM m => TMVarDefault m a -> STM m (Maybe a) Source #
putTMVarDefault :: MonadSTM m => TMVarDefault m a -> a -> STM m () Source #
tryPutTMVarDefault :: MonadSTM m => TMVarDefault m a -> a -> STM m Bool Source #
readTMVarDefault :: MonadSTM m => TMVarDefault m a -> STM m a Source #
tryReadTMVarDefault :: MonadSTM m => TMVarDefault m a -> STM m (Maybe a) Source #
swapTMVarDefault :: MonadSTM m => TMVarDefault m a -> a -> STM m a Source #
writeTMVarDefault :: MonadSTM m => TMVarDefault m a -> a -> STM m () Source #
isEmptyTMVarDefault :: MonadSTM m => TMVarDefault m a -> STM m Bool Source #
labelTMVarDefault :: MonadLabelledSTM m => TMVarDefault m a -> String -> STM m () Source #
traceTMVarDefault :: MonadTraceSTM m => proxy m -> TMVarDefault m a -> (Maybe (Maybe a) -> Maybe a -> InspectMonad m TraceValue) -> STM m () Source #
Default MonadSTM
implementation
newTQueueDefault :: MonadSTM m => STM m (TQueueDefault m a) Source #
writeTQueueDefault :: MonadSTM m => TQueueDefault m a -> a -> STM m () Source #
readTQueueDefault :: MonadSTM m => TQueueDefault m a -> STM m a Source #
tryReadTQueueDefault :: MonadSTM m => TQueueDefault m a -> STM m (Maybe a) Source #
isEmptyTQueueDefault :: MonadSTM m => TQueueDefault m a -> STM m Bool Source #
peekTQueueDefault :: MonadSTM m => TQueueDefault m a -> STM m a Source #
tryPeekTQueueDefault :: MonadSTM m => TQueueDefault m a -> STM m (Maybe a) Source #
flushTQueueDefault :: MonadSTM m => TQueueDefault m a -> STM m [a] Source #
unGetTQueueDefault :: MonadSTM m => TQueueDefault m a -> a -> STM m () Source #
labelTQueueDefault :: MonadLabelledSTM m => TQueueDefault m a -> String -> STM m () Source #
Default MonadSTM
implementation
data TBQueueDefault m a Source #
newTBQueueDefault :: MonadSTM m => Natural -> STM m (TBQueueDefault m a) Source #
writeTBQueueDefault :: MonadSTM m => TBQueueDefault m a -> a -> STM m () Source #
readTBQueueDefault :: MonadSTM m => TBQueueDefault m a -> STM m a Source #
tryReadTBQueueDefault :: MonadSTM m => TBQueueDefault m a -> STM m (Maybe a) Source #
peekTBQueueDefault :: MonadSTM m => TBQueueDefault m a -> STM m a Source #
tryPeekTBQueueDefault :: MonadSTM m => TBQueueDefault m a -> STM m (Maybe a) Source #
isEmptyTBQueueDefault :: MonadSTM m => TBQueueDefault m a -> STM m Bool Source #
isFullTBQueueDefault :: MonadSTM m => TBQueueDefault m a -> STM m Bool Source #
lengthTBQueueDefault :: MonadSTM m => TBQueueDefault m a -> STM m Natural Source #
flushTBQueueDefault :: MonadSTM m => TBQueueDefault m a -> STM m [a] Source #
unGetTBQueueDefault :: MonadSTM m => TBQueueDefault m a -> a -> STM m () Source #
labelTBQueueDefault :: MonadLabelledSTM m => TBQueueDefault m a -> String -> STM m () Source #
Default MonadSTM
implementation
data TArrayDefault m i e Source #
Default implementation of MonadSTM
.
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 MonadSTM
implementation
newTSemDefault :: MonadSTM m => Integer -> STM m (TSemDefault m) Source #
waitTSemDefault :: MonadSTM m => TSemDefault m -> STM m () Source #
signalTSemDefault :: MonadSTM m => TSemDefault m -> STM m () Source #
signalTSemNDefault :: MonadSTM m => Natural -> TSemDefault m -> STM m () Source #
labelTSemDefault :: MonadLabelledSTM m => TSemDefault m -> String -> STM m () Source #
Default MonadSTM
implementation
newTChanDefault :: MonadSTM m => STM m (TChanDefault m a) Source #
newBroadcastTChanDefault :: MonadSTM m => STM m (TChanDefault m a) Source #
writeTChanDefault :: MonadSTM m => TChanDefault m a -> a -> STM m () Source #
readTChanDefault :: MonadSTM m => TChanDefault m a -> STM m a Source #
tryReadTChanDefault :: MonadSTM m => TChanDefault m a -> STM m (Maybe a) Source #
peekTChanDefault :: MonadSTM m => TChanDefault m a -> STM m a Source #
tryPeekTChanDefault :: MonadSTM m => TChanDefault m a -> STM m (Maybe a) Source #
dupTChanDefault :: MonadSTM m => TChanDefault m a -> STM m (TChanDefault m a) Source #
unGetTChanDefault :: MonadSTM m => TChanDefault m a -> a -> STM m () Source #
isEmptyTChanDefault :: MonadSTM m => TChanDefault m a -> STM m Bool Source #
cloneTChanDefault :: MonadSTM m => TChanDefault m a -> STM m (TChanDefault m a) Source #
labelTChanDefault :: MonadLabelledSTM m => TChanDefault m a -> String -> STM m () Source #