io-classes-1.3.0.0: Type classes for concurrency with STM, ST and timing
Safe HaskellSafe-Inferred
LanguageHaskell2010

Control.Monad.Class.MonadSTM.Internal

Synopsis

Documentation

class (Monad m, Monad (STM m)) => MonadSTM m where Source #

The STM primitives parametrised by a monad m.

Associated Types

type STM m = (stm :: Type -> Type) | stm -> m Source #

The STM monad.

type TVar m :: Type -> Type Source #

A type of a TVar.

See TVar.

type TMVar m :: Type -> Type Source #

type TQueue m :: Type -> Type Source #

type TBQueue m :: Type -> Type Source #

type TArray m :: Type -> Type -> Type Source #

type TSem m :: Type Source #

type TChan m :: Type -> Type Source #

Methods

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 #

retry :: STM m a 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 #

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

Instances details
MonadSTM IO Source # 
Instance details

Defined in Control.Monad.Class.MonadSTM.Internal

Associated Types

type STM IO = (stm :: Type -> Type) Source #

type TVar IO :: Type -> Type Source #

type TMVar IO :: Type -> Type Source #

type TQueue IO :: Type -> Type Source #

type TBQueue IO :: Type -> Type Source #

type TArray IO :: Type -> Type -> Type Source #

type TSem IO Source #

type TChan IO :: Type -> Type Source #

Methods

atomically :: HasCallStack => STM IO a -> IO a Source #

newTVar :: a -> STM IO (TVar IO a) Source #

readTVar :: TVar IO a -> STM IO a Source #

writeTVar :: TVar IO a -> a -> STM IO () Source #

retry :: STM IO a Source #

orElse :: STM IO a -> STM IO a -> STM IO a Source #

modifyTVar :: TVar IO a -> (a -> a) -> STM IO () Source #

modifyTVar' :: TVar IO a -> (a -> a) -> STM IO () Source #

stateTVar :: TVar IO s -> (s -> (a, s)) -> STM IO a Source #

swapTVar :: TVar IO a -> a -> STM IO a Source #

check :: Bool -> STM IO () Source #

newTMVar :: a -> STM IO (TMVar IO a) Source #

newEmptyTMVar :: STM IO (TMVar IO a) Source #

takeTMVar :: TMVar IO a -> STM IO a Source #

tryTakeTMVar :: TMVar IO a -> STM IO (Maybe a) Source #

putTMVar :: TMVar IO a -> a -> STM IO () Source #

tryPutTMVar :: TMVar IO a -> a -> STM IO Bool Source #

readTMVar :: TMVar IO a -> STM IO a Source #

tryReadTMVar :: TMVar IO a -> STM IO (Maybe a) Source #

swapTMVar :: TMVar IO a -> a -> STM IO a Source #

isEmptyTMVar :: TMVar IO a -> STM IO Bool Source #

newTQueue :: STM IO (TQueue IO a) Source #

readTQueue :: TQueue IO a -> STM IO a Source #

tryReadTQueue :: TQueue IO a -> STM IO (Maybe a) Source #

peekTQueue :: TQueue IO a -> STM IO a Source #

tryPeekTQueue :: TQueue IO a -> STM IO (Maybe a) Source #

flushTQueue :: TQueue IO a -> STM IO [a] Source #

writeTQueue :: TQueue IO a -> a -> STM IO () Source #

isEmptyTQueue :: TQueue IO a -> STM IO Bool Source #

unGetTQueue :: TQueue IO a -> a -> STM IO () Source #

newTBQueue :: Natural -> STM IO (TBQueue IO a) Source #

readTBQueue :: TBQueue IO a -> STM IO a Source #

tryReadTBQueue :: TBQueue IO a -> STM IO (Maybe a) Source #

peekTBQueue :: TBQueue IO a -> STM IO a Source #

tryPeekTBQueue :: TBQueue IO a -> STM IO (Maybe a) Source #

flushTBQueue :: TBQueue IO a -> STM IO [a] Source #

writeTBQueue :: TBQueue IO a -> a -> STM IO () Source #

lengthTBQueue :: TBQueue IO a -> STM IO Natural Source #

isEmptyTBQueue :: TBQueue IO a -> STM IO Bool Source #

isFullTBQueue :: TBQueue IO a -> STM IO Bool Source #

unGetTBQueue :: TBQueue IO a -> a -> STM IO () Source #

newTSem :: Integer -> STM IO (TSem IO) Source #

waitTSem :: TSem IO -> STM IO () Source #

signalTSem :: TSem IO -> STM IO () Source #

signalTSemN :: Natural -> TSem IO -> STM IO () Source #

newTChan :: STM IO (TChan IO a) Source #

newBroadcastTChan :: STM IO (TChan IO a) Source #

dupTChan :: TChan IO a -> STM IO (TChan IO a) Source #

cloneTChan :: TChan IO a -> STM IO (TChan IO a) Source #

readTChan :: TChan IO a -> STM IO a Source #

tryReadTChan :: TChan IO a -> STM IO (Maybe a) Source #

peekTChan :: TChan IO a -> STM IO a Source #

tryPeekTChan :: TChan IO a -> STM IO (Maybe a) Source #

writeTChan :: TChan IO a -> a -> STM IO () Source #

unGetTChan :: TChan IO a -> a -> STM IO () Source #

isEmptyTChan :: TChan IO a -> STM IO Bool Source #

newTVarIO :: a -> IO (TVar IO a) Source #

readTVarIO :: TVar IO a -> IO a Source #

newTMVarIO :: a -> IO (TMVar IO a) Source #

newEmptyTMVarIO :: IO (TMVar IO a) Source #

newTQueueIO :: IO (TQueue IO a) Source #

newTBQueueIO :: Natural -> IO (TBQueue IO a) Source #

newTChanIO :: IO (TChan IO a) Source #

newBroadcastTChanIO :: IO (TChan IO a) Source #

MonadSTM m => MonadSTM (ReaderT r m) Source #

The underlying stm monad is also transformed.

Instance details

Defined in Control.Monad.Class.MonadSTM.Internal

Associated Types

type STM (ReaderT r m) = (stm :: Type -> Type) Source #

type TVar (ReaderT r m) :: Type -> Type Source #

type TMVar (ReaderT r m) :: Type -> Type Source #

type TQueue (ReaderT r m) :: Type -> Type Source #

type TBQueue (ReaderT r m) :: Type -> Type Source #

type TArray (ReaderT r m) :: Type -> Type -> Type Source #

type TSem (ReaderT r m) Source #

type TChan (ReaderT r m) :: Type -> Type Source #

Methods

atomically :: HasCallStack => STM (ReaderT r m) a -> ReaderT r m a Source #

newTVar :: a -> STM (ReaderT r m) (TVar (ReaderT r m) a) Source #

readTVar :: TVar (ReaderT r m) a -> STM (ReaderT r m) a Source #

writeTVar :: TVar (ReaderT r m) a -> a -> STM (ReaderT r m) () Source #

retry :: STM (ReaderT r m) a Source #

orElse :: STM (ReaderT r m) a -> STM (ReaderT r m) a -> STM (ReaderT r m) a Source #

modifyTVar :: TVar (ReaderT r m) a -> (a -> a) -> STM (ReaderT r m) () Source #

modifyTVar' :: TVar (ReaderT r m) a -> (a -> a) -> STM (ReaderT r m) () Source #

stateTVar :: TVar (ReaderT r m) s -> (s -> (a, s)) -> STM (ReaderT r m) a Source #

swapTVar :: TVar (ReaderT r m) a -> a -> STM (ReaderT r m) a Source #

check :: Bool -> STM (ReaderT r m) () Source #

newTMVar :: a -> STM (ReaderT r m) (TMVar (ReaderT r m) a) Source #

newEmptyTMVar :: STM (ReaderT r m) (TMVar (ReaderT r m) a) Source #

takeTMVar :: TMVar (ReaderT r m) a -> STM (ReaderT r m) a Source #

tryTakeTMVar :: TMVar (ReaderT r m) a -> STM (ReaderT r m) (Maybe a) Source #

putTMVar :: TMVar (ReaderT r m) a -> a -> STM (ReaderT r m) () Source #

tryPutTMVar :: TMVar (ReaderT r m) a -> a -> STM (ReaderT r m) Bool Source #

readTMVar :: TMVar (ReaderT r m) a -> STM (ReaderT r m) a Source #

tryReadTMVar :: TMVar (ReaderT r m) a -> STM (ReaderT r m) (Maybe a) Source #

swapTMVar :: TMVar (ReaderT r m) a -> a -> STM (ReaderT r m) a Source #

isEmptyTMVar :: TMVar (ReaderT r m) a -> STM (ReaderT r m) Bool Source #

newTQueue :: STM (ReaderT r m) (TQueue (ReaderT r m) a) Source #

readTQueue :: TQueue (ReaderT r m) a -> STM (ReaderT r m) a Source #

tryReadTQueue :: TQueue (ReaderT r m) a -> STM (ReaderT r m) (Maybe a) Source #

peekTQueue :: TQueue (ReaderT r m) a -> STM (ReaderT r m) a Source #

tryPeekTQueue :: TQueue (ReaderT r m) a -> STM (ReaderT r m) (Maybe a) Source #

flushTQueue :: TQueue (ReaderT r m) a -> STM (ReaderT r m) [a] Source #

writeTQueue :: TQueue (ReaderT r m) a -> a -> STM (ReaderT r m) () Source #

isEmptyTQueue :: TQueue (ReaderT r m) a -> STM (ReaderT r m) Bool Source #

unGetTQueue :: TQueue (ReaderT r m) a -> a -> STM (ReaderT r m) () Source #

newTBQueue :: Natural -> STM (ReaderT r m) (TBQueue (ReaderT r m) a) Source #

readTBQueue :: TBQueue (ReaderT r m) a -> STM (ReaderT r m) a Source #

tryReadTBQueue :: TBQueue (ReaderT r m) a -> STM (ReaderT r m) (Maybe a) Source #

peekTBQueue :: TBQueue (ReaderT r m) a -> STM (ReaderT r m) a Source #

tryPeekTBQueue :: TBQueue (ReaderT r m) a -> STM (ReaderT r m) (Maybe a) Source #

flushTBQueue :: TBQueue (ReaderT r m) a -> STM (ReaderT r m) [a] Source #

writeTBQueue :: TBQueue (ReaderT r m) a -> a -> STM (ReaderT r m) () Source #

lengthTBQueue :: TBQueue (ReaderT r m) a -> STM (ReaderT r m) Natural Source #

isEmptyTBQueue :: TBQueue (ReaderT r m) a -> STM (ReaderT r m) Bool Source #

isFullTBQueue :: TBQueue (ReaderT r m) a -> STM (ReaderT r m) Bool Source #

unGetTBQueue :: TBQueue (ReaderT r m) a -> a -> STM (ReaderT r m) () Source #

newTSem :: Integer -> STM (ReaderT r m) (TSem (ReaderT r m)) Source #

waitTSem :: TSem (ReaderT r m) -> STM (ReaderT r m) () Source #

signalTSem :: TSem (ReaderT r m) -> STM (ReaderT r m) () Source #

signalTSemN :: Natural -> TSem (ReaderT r m) -> STM (ReaderT r m) () Source #

newTChan :: STM (ReaderT r m) (TChan (ReaderT r m) a) Source #

newBroadcastTChan :: STM (ReaderT r m) (TChan (ReaderT r m) a) Source #

dupTChan :: TChan (ReaderT r m) a -> STM (ReaderT r m) (TChan (ReaderT r m) a) Source #

cloneTChan :: TChan (ReaderT r m) a -> STM (ReaderT r m) (TChan (ReaderT r m) a) Source #

readTChan :: TChan (ReaderT r m) a -> STM (ReaderT r m) a Source #

tryReadTChan :: TChan (ReaderT r m) a -> STM (ReaderT r m) (Maybe a) Source #

peekTChan :: TChan (ReaderT r m) a -> STM (ReaderT r m) a Source #

tryPeekTChan :: TChan (ReaderT r m) a -> STM (ReaderT r m) (Maybe a) Source #

writeTChan :: TChan (ReaderT r m) a -> a -> STM (ReaderT r m) () Source #

unGetTChan :: TChan (ReaderT r m) a -> a -> STM (ReaderT r m) () Source #

isEmptyTChan :: TChan (ReaderT r m) a -> STM (ReaderT r m) Bool Source #

newTVarIO :: a -> ReaderT r m (TVar (ReaderT r m) a) Source #

readTVarIO :: TVar (ReaderT r m) a -> ReaderT r m a Source #

newTMVarIO :: a -> ReaderT r m (TMVar (ReaderT r m) a) Source #

newEmptyTMVarIO :: ReaderT r m (TMVar (ReaderT r m) a) Source #

newTQueueIO :: ReaderT r m (TQueue (ReaderT r m) a) Source #

newTBQueueIO :: Natural -> ReaderT r m (TBQueue (ReaderT r m) a) Source #

newTChanIO :: ReaderT r m (TChan (ReaderT r m) a) Source #

newBroadcastTChanIO :: ReaderT r m (TChan (ReaderT r m) a) Source #

class MonadSTM m => MonadLabelledSTM m where Source #

Labelled TVars & 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).

Minimal complete definition

labelTVar

Methods

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 #

default labelTSem :: TSem m ~ TSemDefault m => 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 #

default 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

Instances details
MonadLabelledSTM IO Source #

noop instance

Instance details

Defined in Control.Monad.Class.MonadSTM.Internal

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.

Associated Types

type InspectMonad m :: Type -> Type Source #

Methods

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 TVars.

inspectTMVar :: proxy m -> TMVar m a -> InspectMonad m (Maybe a) Source #

Return the value of a MonadSTM as an InspectMonad computation.

Instances

Instances details
MonadInspectSTM IO Source # 
Instance details

Defined in Control.Monad.Class.MonadSTM.Internal

Associated Types

type InspectMonad IO :: Type -> Type Source #

Methods

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 IOSims dynamic tracing allows to recover the value from the simulation trace (see "Control.Monad.IOSim.selectTraceEventsDynamic").

Constructors

TraceValue 

Fields

Bundled Patterns

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.

Minimal complete definition

traceTVar, traceTQueue, traceTBQueue

Methods

traceTVar Source #

Arguments

:: proxy m 
-> TVar m a 
-> (Maybe a -> a -> InspectMonad m TraceValue)

callback which receives initial value or Nothing (if it is a newly created TVar), and the committed value.

-> 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

Instances details
MonadTraceSTM IO Source #

noop instance

Instance details

Defined in Control.Monad.Class.MonadSTM.Internal

Methods

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 #

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.

newtype TMVarDefault m a Source #

Constructors

TMVar (TVar m (Maybe a)) 

putTMVarDefault :: MonadSTM m => TMVarDefault m a -> a -> 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

data TQueueDefault m a Source #

Constructors

TQueue !(TVar m [a]) !(TVar m [a]) 

Default MonadSTM implementation

data TBQueueDefault m a Source #

Constructors

TBQueue !(TVar m Natural) !(TVar m [a]) !(TVar m Natural) !(TVar m [a]) !Natural 

Default MonadSTM implementation

data TArrayDefault m i e Source #

Default implementation of MonadSTM.

Constructors

TArray (Array i (TVar m e)) 

Instances

Instances details
(Monad stm, MonadSTM m, stm ~ STM m) => MArray (TArrayDefault m) e stm Source # 
Instance details

Defined in Control.Monad.Class.MonadSTM.Internal

Methods

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 # 
Instance details

Defined in Control.Monad.Class.MonadSTM.Internal

Methods

(==) :: TArrayDefault m i e -> TArrayDefault m i e -> Bool #

(/=) :: TArrayDefault m i e -> TArrayDefault m i e -> Bool #

Default MonadSTM implementation

newtype TSemDefault m Source #

Constructors

TSem (TVar m Integer) 

Default MonadSTM implementation

data TChanDefault m a Source #

Constructors

TChan (TVar m (TVarList m a)) (TVar m (TVarList m a))