Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- catchSTM :: forall (m :: Type -> Type ) e a. ( MonadSTM m, MonadCatch ( STM m), Exception e) => STM m a -> (e -> STM m a) -> STM m a
- throwSTM :: forall (m :: Type -> Type ) e a. ( MonadSTM m, MonadThrow ( STM m), Exception e) => e -> STM m a
- flushTBQueueDefault :: forall (m :: Type -> Type ) a. MonadSTM m => TBQueueDefault m a -> STM m [a]
- lengthTBQueueDefault :: forall (m :: Type -> Type ) a. MonadSTM m => TBQueueDefault m a -> STM m Natural
- isFullTBQueueDefault :: forall (m :: Type -> Type ) a. MonadSTM m => TBQueueDefault m a -> STM m Bool
- isEmptyTBQueueDefault :: forall (m :: Type -> Type ) a. MonadSTM m => TBQueueDefault m a -> STM m Bool
- writeTBQueueDefault :: forall (m :: Type -> Type ) a. MonadSTM m => TBQueueDefault m a -> a -> STM m ()
- tryPeekTBQueueDefault :: 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
- tryReadTBQueueDefault :: forall (m :: Type -> Type ) a. MonadSTM m => TBQueueDefault m a -> STM m ( Maybe a)
- readTBQueueDefault :: forall (m :: Type -> Type ) a. MonadSTM m => TBQueueDefault m a -> STM m a
- newTBQueueDefault :: forall (m :: Type -> Type ) a. MonadSTM m => Natural -> STM m ( TBQueueDefault m a)
- labelTBQueueDefault :: forall (m :: Type -> Type ) a. MonadLabelledSTM m => TBQueueDefault m a -> String -> STM m ()
- tryPeekTQueueDefault :: forall (m :: Type -> Type ) a. MonadSTM m => TQueueDefault m a -> STM m ( Maybe a)
- peekTQueueDefault :: forall (m :: Type -> Type ) a. MonadSTM m => TQueueDefault m a -> STM m a
- isEmptyTQueueDefault :: forall (m :: Type -> Type ) a. MonadSTM m => TQueueDefault m a -> STM m Bool
- tryReadTQueueDefault :: forall (m :: Type -> Type ) a. MonadSTM m => TQueueDefault m a -> STM m ( Maybe a)
- readTQueueDefault :: forall (m :: Type -> Type ) a. MonadSTM m => TQueueDefault m a -> STM m a
- writeTQueueDefault :: forall (m :: Type -> Type ) a. MonadSTM m => TQueueDefault m a -> a -> STM m ()
- newTQueueDefault :: forall (m :: Type -> Type ) a. MonadSTM m => STM m ( TQueueDefault m a)
- labelTQueueDefault :: forall (m :: Type -> Type ) a. MonadLabelledSTM m => TQueueDefault m a -> String -> STM m ()
- isEmptyTMVarDefault :: forall (m :: Type -> Type ) a. MonadSTM m => TMVarDefault m a -> STM m Bool
- swapTMVarDefault :: forall (m :: Type -> Type ) a. MonadSTM m => TMVarDefault m a -> a -> STM m a
- tryReadTMVarDefault :: forall (m :: Type -> Type ) a. MonadSTM m => TMVarDefault m a -> STM m ( Maybe a)
- readTMVarDefault :: forall (m :: Type -> Type ) a. MonadSTM m => TMVarDefault m a -> STM m a
- tryPutTMVarDefault :: forall (m :: Type -> Type ) a. MonadSTM m => TMVarDefault m a -> a -> STM m Bool
- putTMVarDefault :: forall (m :: Type -> Type ) a. MonadSTM m => TMVarDefault m a -> a -> STM m ()
- tryTakeTMVarDefault :: forall (m :: Type -> Type ) a. MonadSTM m => TMVarDefault m a -> STM m ( Maybe a)
- takeTMVarDefault :: forall (m :: Type -> Type ) a. MonadSTM m => TMVarDefault m a -> STM m a
- newEmptyTMVarMDefault :: MonadSTM m => m ( TMVarDefault m a)
- newEmptyTMVarIODefault :: MonadSTM m => m ( TMVarDefault m a)
- newEmptyTMVarDefault :: forall (m :: Type -> Type ) a. MonadSTM m => STM m ( TMVarDefault m a)
- newTMVarMDefault :: MonadSTM m => a -> m ( TMVarDefault m a)
- newTMVarIODefault :: MonadSTM m => a -> m ( TMVarDefault m a)
- newTMVarDefault :: forall (m :: Type -> Type ) a. MonadSTM m => a -> STM m ( TMVarDefault m a)
- traceTMVarDefault :: forall (m :: Type -> Type ) proxy a. MonadTraceSTM m => proxy m -> TMVarDefault m a -> ( Maybe ( Maybe a) -> Maybe a -> InspectMonad m TraceValue ) -> STM m ()
- labelTMVarDefault :: forall (m :: Type -> Type ) a. MonadLabelledSTM m => TMVarDefault m a -> String -> STM m ()
- type family TBQueue (m :: Type -> Type ) :: Type -> Type
- type family TQueue (m :: Type -> Type ) :: Type -> Type
- type family STM (m :: Type -> Type ) = (stm :: Type -> Type ) | stm -> m
-
class
(
Monad
m,
Alternative
(
STM
m),
MonadPlus
(
STM
m)) =>
MonadSTM
(m ::
Type
->
Type
)
where
- type STM (m :: Type -> Type ) = (stm :: Type -> Type ) | stm -> m
- type TQueue (m :: Type -> Type ) :: Type -> Type
- type TBQueue (m :: Type -> Type ) :: Type -> Type
- atomically :: HasCallStack => STM m a -> m a
- retry :: STM m a
- orElse :: STM m a -> STM m a -> STM m a
- modifyTVar' :: TVar m a -> (a -> a) -> STM m ()
- check :: Bool -> STM m ()
- 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)
- writeTQueue :: TQueue m a -> a -> STM m ()
- isEmptyTQueue :: TQueue m a -> STM m Bool
- 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
- newTQueueIO :: m ( TQueue m a)
- newTBQueueIO :: Natural -> m ( TBQueue m a)
-
class
MonadSTM
m =>
MonadLabelledSTM
(m ::
Type
->
Type
)
where
- labelTQueue :: TQueue m a -> String -> STM m ()
- labelTBQueue :: TBQueue m a -> String -> STM m ()
- labelTQueueIO :: TQueue m a -> String -> m ()
- labelTBQueueIO :: TBQueue m a -> String -> m ()
- type family InspectMonad (m :: Type -> Type ) :: Type -> Type
-
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
- 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 ()
- traceTQueueIO :: proxy m -> TQueue m a -> ( Maybe [a] -> [a] -> InspectMonad m TraceValue ) -> m ()
- traceTBQueueIO :: proxy m -> TBQueue m a -> ( Maybe [a] -> [a] -> InspectMonad m TraceValue ) -> m ()
- data TMVarDefault (m :: Type -> Type ) a
- data TQueueDefault (m :: Type -> Type ) a = TQueue !( TVar m [a]) !( TVar m [a])
- data TBQueueDefault (m :: Type -> Type ) a = TBQueue !( TVar m Natural ) !( TVar m [a]) !( TVar m Natural ) !( TVar m [a]) ! Natural
-
newtype
WrappedSTM
(t :: Trans) r (m ::
Type
->
Type
) a =
WrappedSTM
{
- runWrappedSTM :: STM m a
- data StrictTVar (m :: Type -> Type ) a
- checkInvariant :: HasCallStack => Maybe String -> a -> a
- isEmptyTMVar :: forall (m :: Type -> Type ) a. MonadSTM m => StrictTMVar m a -> STM m Bool
- swapTMVar :: forall (m :: Type -> Type ) a. MonadSTM m => StrictTMVar m a -> a -> STM m a
- tryReadTMVar :: forall (m :: Type -> Type ) a. MonadSTM m => StrictTMVar m a -> STM m ( Maybe a)
- readTMVar :: forall (m :: Type -> Type ) a. MonadSTM m => StrictTMVar m a -> STM m a
- tryPutTMVar :: forall (m :: Type -> Type ) a. MonadSTM m => StrictTMVar m a -> a -> STM m Bool
- putTMVar :: forall (m :: Type -> Type ) a. MonadSTM m => StrictTMVar m a -> a -> STM m ()
- tryTakeTMVar :: forall (m :: Type -> Type ) a. MonadSTM m => StrictTMVar m a -> STM m ( Maybe a)
- takeTMVar :: forall (m :: Type -> Type ) a. MonadSTM m => StrictTMVar m a -> STM m a
- newEmptyTMVarM :: MonadSTM m => m ( StrictTMVar m a)
- newEmptyTMVar :: forall (m :: Type -> Type ) a. MonadSTM m => STM m ( StrictTMVar m a)
- newTMVarM :: MonadSTM m => a -> m ( StrictTMVar m a)
- castStrictTMVar :: forall (m :: Type -> Type ) (n :: Type -> Type ) a. LazyTMVar m ~ LazyTMVar n => StrictTMVar m a -> StrictTMVar n a
- traceTMVarIO :: MonadTraceSTM m => proxy m -> StrictTMVar m a -> ( Maybe ( Maybe a) -> Maybe a -> InspectMonad m TraceValue ) -> m ()
- traceTMVar :: forall (m :: Type -> Type ) proxy a. MonadTraceSTM m => proxy m -> StrictTMVar m a -> ( Maybe ( Maybe a) -> Maybe a -> InspectMonad m TraceValue ) -> STM m ()
- labelTMVarIO :: MonadLabelledSTM m => StrictTMVar m a -> String -> m ()
- labelTMVar :: forall (m :: Type -> Type ) a. MonadLabelledSTM m => StrictTMVar m a -> String -> STM m ()
- fromLazyTMVar :: forall (m :: Type -> Type ) a. LazyTMVar m a -> StrictTMVar m a
- updateTVar :: forall (m :: Type -> Type ) s a. MonadSTM m => StrictTVar m s -> (s -> (a, s)) -> STM m a
- swapTVar :: forall (m :: Type -> Type ) a. MonadSTM m => StrictTVar m a -> a -> STM m a
- stateTVar :: forall (m :: Type -> Type ) s a. MonadSTM m => StrictTVar m s -> (s -> (a, s)) -> STM m a
- modifyTVar :: forall (m :: Type -> Type ) a. MonadSTM m => StrictTVar m a -> (a -> a) -> STM m ()
- writeTVar :: forall (m :: Type -> Type ) a. ( MonadSTM m, HasCallStack ) => StrictTVar m a -> a -> STM m ()
- readTVarIO :: MonadSTM m => StrictTVar m a -> m a
- readTVar :: forall (m :: Type -> Type ) a. MonadSTM m => StrictTVar m a -> STM m a
- newTVarWithInvariantM :: ( MonadSTM m, HasCallStack ) => (a -> Maybe String ) -> a -> m ( StrictTVar m a)
- newTVarWithInvariant :: forall (m :: Type -> Type ) a. ( MonadSTM m, HasCallStack ) => (a -> Maybe String ) -> a -> STM m ( StrictTVar m a)
- newTVarM :: MonadSTM m => a -> m ( StrictTVar m a)
- fromLazyTVar :: forall (m :: Type -> Type ) a. LazyTVar m a -> StrictTVar m a
- toLazyTVar :: forall (m :: Type -> Type ) a. StrictTVar m a -> LazyTVar m a
- castStrictTVar :: forall (m :: Type -> Type ) (n :: Type -> Type ) a. LazyTVar m ~ LazyTVar n => StrictTVar m a -> StrictTVar n a
- traceTVarIO :: MonadTraceSTM m => proxy m -> StrictTVar m a -> ( Maybe a -> a -> InspectMonad m TraceValue ) -> m ()
- traceTVar :: forall (m :: Type -> Type ) proxy a. MonadTraceSTM m => proxy m -> StrictTVar m a -> ( Maybe a -> a -> InspectMonad m TraceValue ) -> STM m ()
- labelTVarIO :: MonadLabelledSTM m => StrictTVar m a -> String -> m ()
- labelTVar :: forall (m :: Type -> Type ) a. MonadLabelledSTM m => StrictTVar m a -> String -> STM m ()
- type LazyTVar (m :: Type -> Type ) = TVar m
- type LazyTMVar (m :: Type -> Type ) = TMVar m
- data StrictTMVar (m :: Type -> Type ) a
- data StrictMVar m a = StrictMVar { }
- castStrictMVar :: ( TMVar m ~ TMVar n, TVar m ~ TVar n) => StrictMVar m a -> StrictMVar n a
- takeMVar :: MonadSTM m => StrictMVar m a -> m a
- tryTakeMVar :: MonadSTM m => StrictMVar m a -> m ( Maybe a)
- putMVar :: ( MonadSTM m, HasCallStack ) => StrictMVar m a -> a -> m ()
- tryPutMVar :: ( MonadSTM m, HasCallStack ) => StrictMVar m a -> a -> m Bool
- readMVar :: MonadSTM m => StrictMVar m a -> m a
- tryReadMVar :: MonadSTM m => StrictMVar m a -> m ( Maybe a)
- readMVarSTM :: MonadSTM m => StrictMVar m a -> STM m a
- swapMVar :: ( MonadSTM m, HasCallStack ) => StrictMVar m a -> a -> m a
- isEmptyMVar :: MonadSTM m => StrictMVar m a -> m Bool
- updateMVar :: ( MonadSTM m, HasCallStack ) => StrictMVar m a -> (a -> (a, b)) -> m b
- updateMVar_ :: ( MonadSTM m, HasCallStack ) => StrictMVar m a -> (a -> a) -> m ()
- modifyMVar :: ( MonadSTM m, MonadCatch m, HasCallStack ) => StrictMVar m a -> (a -> m (a, b)) -> m b
- modifyMVar_ :: ( MonadSTM m, MonadCatch m, HasCallStack ) => StrictMVar m a -> (a -> m a) -> m ()
- newEmptyMVar :: ( MonadSTM m, NoThunks a) => a -> m ( StrictMVar m a)
- newMVar :: ( MonadSTM m, HasCallStack , NoThunks a) => a -> m ( StrictMVar m a)
- newTVar :: ( MonadSTM m, HasCallStack , NoThunks a) => a -> STM m ( StrictTVar m a)
- newTVarIO :: ( MonadSTM m, HasCallStack , NoThunks a) => a -> m ( StrictTVar m a)
- uncheckedNewEmptyMVar :: MonadSTM m => a -> m ( StrictMVar m a)
- uncheckedNewMVar :: MonadSTM m => a -> m ( StrictMVar m a)
- uncheckedNewTVarM :: MonadSTM m => a -> m ( StrictTVar m a)
Documentation
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.
throwSTM :: forall (m :: Type -> Type ) e a. ( MonadSTM m, MonadThrow ( STM m), Exception e) => e -> STM m a Source #
throwIO
specialised to
stm
monad.
flushTBQueueDefault :: forall (m :: Type -> Type ) a. MonadSTM m => TBQueueDefault m a -> STM m [a] Source #
lengthTBQueueDefault :: forall (m :: Type -> Type ) a. MonadSTM m => TBQueueDefault m a -> STM m Natural Source #
isFullTBQueueDefault :: forall (m :: Type -> Type ) a. MonadSTM m => TBQueueDefault m a -> STM m Bool Source #
isEmptyTBQueueDefault :: forall (m :: Type -> Type ) a. MonadSTM m => TBQueueDefault m a -> STM m Bool Source #
writeTBQueueDefault :: forall (m :: Type -> Type ) a. MonadSTM m => TBQueueDefault m a -> a -> STM m () Source #
tryPeekTBQueueDefault :: 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 #
tryReadTBQueueDefault :: forall (m :: Type -> Type ) a. MonadSTM m => TBQueueDefault m a -> STM m ( Maybe a) Source #
readTBQueueDefault :: forall (m :: Type -> Type ) a. MonadSTM m => TBQueueDefault m a -> STM m a Source #
newTBQueueDefault :: forall (m :: Type -> Type ) a. MonadSTM m => Natural -> STM m ( TBQueueDefault m a) Source #
labelTBQueueDefault :: forall (m :: Type -> Type ) a. MonadLabelledSTM m => TBQueueDefault m a -> String -> STM m () Source #
tryPeekTQueueDefault :: forall (m :: Type -> Type ) a. MonadSTM m => TQueueDefault m a -> STM m ( Maybe a) Source #
peekTQueueDefault :: forall (m :: Type -> Type ) a. MonadSTM m => TQueueDefault m a -> STM m a Source #
isEmptyTQueueDefault :: forall (m :: Type -> Type ) a. MonadSTM m => TQueueDefault m a -> STM m Bool Source #
tryReadTQueueDefault :: forall (m :: Type -> Type ) a. MonadSTM m => TQueueDefault m a -> STM m ( Maybe a) Source #
readTQueueDefault :: forall (m :: Type -> Type ) a. MonadSTM m => TQueueDefault m a -> STM m a Source #
writeTQueueDefault :: forall (m :: Type -> Type ) a. MonadSTM m => TQueueDefault m a -> a -> STM m () Source #
newTQueueDefault :: forall (m :: Type -> Type ) a. MonadSTM m => STM m ( TQueueDefault m a) Source #
labelTQueueDefault :: forall (m :: Type -> Type ) a. MonadLabelledSTM m => TQueueDefault m a -> String -> STM m () Source #
isEmptyTMVarDefault :: forall (m :: Type -> Type ) a. MonadSTM m => TMVarDefault m a -> STM m Bool Source #
swapTMVarDefault :: forall (m :: Type -> Type ) a. MonadSTM m => TMVarDefault m a -> a -> STM m a Source #
tryReadTMVarDefault :: forall (m :: Type -> Type ) a. MonadSTM m => TMVarDefault m a -> STM m ( Maybe a) Source #
readTMVarDefault :: forall (m :: Type -> Type ) a. MonadSTM m => TMVarDefault m a -> STM m a Source #
tryPutTMVarDefault :: forall (m :: Type -> Type ) a. MonadSTM m => TMVarDefault m a -> a -> STM m Bool Source #
putTMVarDefault :: forall (m :: Type -> Type ) a. MonadSTM m => TMVarDefault m a -> a -> STM m () Source #
tryTakeTMVarDefault :: forall (m :: Type -> Type ) a. MonadSTM m => TMVarDefault m a -> STM m ( Maybe a) Source #
takeTMVarDefault :: forall (m :: Type -> Type ) a. MonadSTM m => TMVarDefault m a -> STM m a Source #
newEmptyTMVarMDefault :: MonadSTM m => m ( TMVarDefault m a) Source #
newEmptyTMVarIODefault :: MonadSTM m => m ( TMVarDefault m a) Source #
newEmptyTMVarDefault :: forall (m :: Type -> Type ) a. MonadSTM m => STM m ( TMVarDefault m a) Source #
newTMVarMDefault :: MonadSTM m => a -> m ( TMVarDefault m a) Source #
newTMVarIODefault :: MonadSTM m => a -> m ( TMVarDefault m a) Source #
newTMVarDefault :: forall (m :: Type -> Type ) a. MonadSTM m => a -> STM m ( TMVarDefault m a) 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 #
labelTMVarDefault :: forall (m :: Type -> Type ) a. MonadLabelledSTM m => TMVarDefault m a -> String -> STM m () Source #
type family TBQueue (m :: Type -> Type ) :: Type -> Type Source #
Instances
type TBQueue IO | |
Defined in Control.Monad.Class.MonadSTM |
|
type TBQueue ( WithEarlyExit m) Source # | |
Defined in Ouroboros.Consensus.Util.EarlyExit |
|
type TBQueue ( StateT s m) | |
Defined in Control.Monad.Class.MonadSTM |
|
type TBQueue ( ReaderT r m) | |
Defined in Control.Monad.Class.MonadSTM |
|
type TBQueue ( ExceptT e m) | |
Defined in Control.Monad.Class.MonadSTM |
|
type TBQueue ( WriterT w m) | |
Defined in Control.Monad.Class.MonadSTM |
|
type TBQueue ( ContT r m) | |
Defined in Control.Monad.Class.MonadSTM |
|
type TBQueue ( RWST r w s m) | |
Defined in Control.Monad.Class.MonadSTM |
type family TQueue (m :: Type -> Type ) :: Type -> Type Source #
Instances
type TQueue IO | |
Defined in Control.Monad.Class.MonadSTM |
|
type TQueue ( WithEarlyExit m) Source # | |
Defined in Ouroboros.Consensus.Util.EarlyExit |
|
type TQueue ( StateT s m) | |
Defined in Control.Monad.Class.MonadSTM |
|
type TQueue ( ReaderT r m) | |
Defined in Control.Monad.Class.MonadSTM |
|
type TQueue ( ExceptT e m) | |
Defined in Control.Monad.Class.MonadSTM |
|
type TQueue ( WriterT w m) | |
Defined in Control.Monad.Class.MonadSTM |
|
type TQueue ( ContT r m) | |
Defined in Control.Monad.Class.MonadSTM |
|
type TQueue ( RWST r w s m) | |
Defined in Control.Monad.Class.MonadSTM |
type family STM (m :: Type -> Type ) = (stm :: Type -> Type ) | stm -> m Source #
Instances
type STM IO | |
Defined in Control.Monad.Class.MonadSTM |
|
type STM ( WithEarlyExit m) Source # | |
Defined in Ouroboros.Consensus.Util.EarlyExit |
|
type STM ( StateT s m) | |
Defined in Control.Monad.Class.MonadSTM |
|
type STM ( ReaderT r m) | |
Defined in Control.Monad.Class.MonadSTM |
|
type STM ( ExceptT e m) | |
Defined in Control.Monad.Class.MonadSTM |
|
type STM ( WriterT w m) | |
Defined in Control.Monad.Class.MonadSTM |
|
type STM ( ContT r m) | |
Defined in Control.Monad.Class.MonadSTM |
|
type STM ( RWST r w s m) | |
Defined in Control.Monad.Class.MonadSTM |
class ( Monad m, Alternative ( STM m), MonadPlus ( STM m)) => MonadSTM (m :: Type -> Type ) where Source #
atomically , newTVar , readTVar , writeTVar , retry , orElse , newTMVar , newEmptyTMVar , takeTMVar , tryTakeTMVar , putTMVar , tryPutTMVar , readTMVar , tryReadTMVar , swapTMVar , isEmptyTMVar , newTQueue , readTQueue , tryReadTQueue , peekTQueue , tryPeekTQueue , writeTQueue , isEmptyTQueue , newTBQueue , readTBQueue , tryReadTBQueue , peekTBQueue , tryPeekTBQueue , flushTBQueue , writeTBQueue , lengthTBQueue , isEmptyTBQueue , isFullTBQueue
type STM (m :: Type -> Type ) = (stm :: Type -> Type ) | stm -> m Source #
atomically :: HasCallStack => STM m a -> m a Source #
orElse :: STM m a -> STM m a -> STM m a Source #
modifyTVar' :: TVar m a -> (a -> a) -> STM m () Source #
check :: Bool -> STM m () 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 #
writeTQueue :: TQueue m a -> a -> STM m () Source #
isEmptyTQueue :: TQueue m a -> STM m Bool 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: io-classes-0.2.0.0
isEmptyTBQueue :: TBQueue m a -> STM m Bool Source #
isFullTBQueue :: TBQueue m a -> STM m Bool Source #
newTQueueIO :: m ( TQueue m a) Source #
newTBQueueIO :: Natural -> m ( TBQueue m a) Source #
Instances
class MonadSTM m => MonadLabelledSTM (m :: Type -> Type ) where Source #
labelTQueue :: TQueue m a -> String -> STM m () Source #
labelTBQueue :: TBQueue m a -> String -> STM m () Source #
labelTQueueIO :: TQueue m a -> String -> m () Source #
labelTBQueueIO :: TBQueue m a -> String -> m () Source #
Instances
MonadLabelledSTM IO |
noop instance |
Defined in Control.Monad.Class.MonadSTM 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 # labelTVarIO :: TVar IO a -> String -> IO () Source # labelTMVarIO :: TMVar IO a -> String -> IO () Source # |
type family InspectMonad (m :: Type -> Type ) :: Type -> Type Source #
Instances
type InspectMonad IO | |
Defined in Control.Monad.Class.MonadSTM |
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
TVar
in the underlying
ST
monad.
inspectTVar :: proxy m -> TVar m a -> InspectMonad m a Source #
inspectTMVar :: proxy m -> TMVar m a -> InspectMonad m ( Maybe a) Source #
Instances
MonadInspectSTM IO | |
Defined in Control.Monad.Class.MonadSTM 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.
traceM
; while
traceString
will be traced with
EventSay
.
TraceValue | |
|
pattern TraceDynamic :: () => Typeable tr => tr -> TraceValue |
Use only 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.
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 #
traceTQueueIO :: proxy m -> TQueue m a -> ( Maybe [a] -> [a] -> InspectMonad m TraceValue ) -> m () Source #
traceTBQueueIO :: proxy m -> TBQueue m a -> ( Maybe [a] -> [a] -> InspectMonad m TraceValue ) -> m () Source #
Instances
MonadTraceSTM IO |
noop instance |
Defined in Control.Monad.Class.MonadSTM 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 # traceTVarIO :: proxy IO -> TVar IO a -> ( Maybe a -> a -> InspectMonad IO TraceValue ) -> IO () Source # traceTMVarIO :: proxy IO -> TMVar IO a -> ( Maybe ( Maybe a) -> Maybe a -> InspectMonad IO TraceValue ) -> IO () Source # traceTQueueIO :: proxy IO -> TQueue IO a -> ( Maybe [a] -> [a] -> InspectMonad IO TraceValue ) -> IO () Source # traceTBQueueIO :: proxy IO -> TBQueue IO a -> ( Maybe [a] -> [a] -> InspectMonad IO TraceValue ) -> IO () Source # |
data TMVarDefault (m :: Type -> Type ) a Source #
data TBQueueDefault (m :: Type -> Type ) a Source #
newtype WrappedSTM (t :: Trans) r (m :: Type -> Type ) a Source #
A newtype wrapper for an
STM
monad for monad transformers.
WrappedSTM | |
|
Instances
data StrictTVar (m :: Type -> Type ) a Source #
checkInvariant :: HasCallStack => Maybe String -> a -> a Source #
Check invariant (if enabled) before continuing
checkInvariant mErr x
is equal to
x
if
mErr == Nothing
, and throws
an error
err
if
mErr == Just err
.
This is exported so that other code that wants to conditionally check invariants can reuse the same logic, rather than having to introduce new per-package flags.
isEmptyTMVar :: forall (m :: Type -> Type ) a. MonadSTM m => StrictTMVar m a -> STM m Bool Source #
tryReadTMVar :: forall (m :: Type -> Type ) a. MonadSTM m => StrictTMVar m a -> STM m ( Maybe a) Source #
tryPutTMVar :: forall (m :: Type -> Type ) a. MonadSTM m => StrictTMVar m a -> a -> STM m Bool Source #
tryTakeTMVar :: forall (m :: Type -> Type ) a. MonadSTM m => StrictTMVar m a -> STM m ( Maybe a) Source #
newEmptyTMVarM :: MonadSTM m => m ( StrictTMVar m a) Source #
newEmptyTMVar :: forall (m :: Type -> Type ) a. MonadSTM m => STM m ( StrictTMVar m a) Source #
newTMVarM :: MonadSTM m => a -> m ( StrictTMVar m a) Source #
castStrictTMVar :: forall (m :: Type -> Type ) (n :: Type -> Type ) a. LazyTMVar m ~ LazyTMVar n => StrictTMVar m a -> StrictTMVar n a Source #
traceTMVarIO :: MonadTraceSTM m => proxy m -> StrictTMVar m a -> ( Maybe ( Maybe a) -> Maybe a -> InspectMonad m TraceValue ) -> m () Source #
traceTMVar :: forall (m :: Type -> Type ) proxy a. MonadTraceSTM m => proxy m -> StrictTMVar m a -> ( Maybe ( Maybe a) -> Maybe a -> InspectMonad m TraceValue ) -> STM m () Source #
labelTMVarIO :: MonadLabelledSTM m => StrictTMVar m a -> String -> m () Source #
labelTMVar :: forall (m :: Type -> Type ) a. MonadLabelledSTM m => StrictTMVar m a -> String -> STM m () Source #
fromLazyTMVar :: forall (m :: Type -> Type ) a. LazyTMVar m a -> StrictTMVar m a Source #
updateTVar :: forall (m :: Type -> Type ) s a. MonadSTM m => StrictTVar m s -> (s -> (a, s)) -> STM m a Source #
stateTVar :: forall (m :: Type -> Type ) s a. MonadSTM m => StrictTVar m s -> (s -> (a, s)) -> STM m a Source #
modifyTVar :: forall (m :: Type -> Type ) a. MonadSTM m => StrictTVar m a -> (a -> a) -> STM m () Source #
writeTVar :: forall (m :: Type -> Type ) a. ( MonadSTM m, HasCallStack ) => StrictTVar m a -> a -> STM m () Source #
readTVarIO :: MonadSTM m => StrictTVar m a -> m a Source #
newTVarWithInvariantM Source #
:: ( MonadSTM m, HasCallStack ) | |
=> (a -> Maybe String ) |
Invariant (expect
|
-> a | |
-> m ( StrictTVar m a) |
:: forall (m :: Type -> Type ) a. ( MonadSTM m, HasCallStack ) | |
=> (a -> Maybe String ) |
Invariant (expect
|
-> a | |
-> STM m ( StrictTVar m a) |
newTVarM :: MonadSTM m => a -> m ( StrictTVar m a) Source #
fromLazyTVar :: forall (m :: Type -> Type ) a. LazyTVar m a -> StrictTVar m a Source #
toLazyTVar :: forall (m :: Type -> Type ) a. 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.
castStrictTVar :: forall (m :: Type -> Type ) (n :: Type -> Type ) a. LazyTVar m ~ LazyTVar n => StrictTVar m a -> StrictTVar n a Source #
traceTVarIO :: MonadTraceSTM m => proxy m -> StrictTVar m a -> ( Maybe a -> a -> InspectMonad m TraceValue ) -> m () Source #
traceTVar :: forall (m :: Type -> Type ) proxy a. MonadTraceSTM m => proxy m -> StrictTVar m a -> ( Maybe a -> a -> InspectMonad m TraceValue ) -> STM m () Source #
labelTVarIO :: MonadLabelledSTM m => StrictTVar m a -> String -> m () Source #
labelTVar :: forall (m :: Type -> Type ) a. MonadLabelledSTM m => StrictTVar m a -> String -> STM m () Source #
data StrictTMVar (m :: Type -> Type ) a Source #
data StrictMVar m a Source #
Strict MVar (modelled using a lazy
TMVar
under the hood)
The
StrictMVar
API is slightly stronger than the usual
MVar
one, as we
offer a primitive to read the value of the MVar even if it is empty (in which
case we will return the oldest known stale one). See
readMVarSTM
.
There is a weaker invariant for a
StrictMVar
than for a
StrictTVar
:
although all functions that modify the
StrictMVar
check the invariant, we
do
not
guarantee that the value inside the
StrictMVar
always satisfies
the invariant. Instead, we
do
guarantee that if the
StrictMVar
is updated
with a value that does not satisfy the invariant, an exception is thrown. The
reason for this weaker guarantee is that leaving an
MVar
empty can lead to
very hard to debug "blocked indefinitely" problems.
This is also the reason we do not offer support for an invariant in
StrictTMVar
: if we throw an exception from an STM transaction, the STM
transaction is not executed, and so we would not even be able to provide the
weaker guarantee that we provide for
StrictMVar
.
StrictMVar | |
|
castStrictMVar :: ( TMVar m ~ TMVar n, TVar m ~ TVar n) => StrictMVar m a -> StrictMVar n a Source #
takeMVar :: MonadSTM m => StrictMVar m a -> m a Source #
tryTakeMVar :: MonadSTM m => StrictMVar m a -> m ( Maybe a) Source #
putMVar :: ( MonadSTM m, HasCallStack ) => StrictMVar m a -> a -> m () Source #
tryPutMVar :: ( MonadSTM m, HasCallStack ) => StrictMVar m a -> a -> m Bool Source #
readMVar :: MonadSTM m => StrictMVar m a -> m a Source #
tryReadMVar :: MonadSTM m => StrictMVar m a -> m ( Maybe a) Source #
readMVarSTM :: MonadSTM m => StrictMVar m a -> STM m a Source #
Read the possibly-stale value of the
MVar
Will return the current value of the
MVar
if it non-empty, or the last
known value otherwise.
swapMVar :: ( MonadSTM m, HasCallStack ) => StrictMVar m a -> a -> m a Source #
Swap value of a
StrictMVar
NOTE: Since swapping the value can't leave the
StrictMVar
empty, we
could
check the invariant first and only then swap. We nonetheless swap
first and check the invariant after to keep the semantics the same with
putMVar
, otherwise it will be difficult to understand when a
StrictMVar
is updated and when it is not.
isEmptyMVar :: MonadSTM m => StrictMVar m a -> m Bool Source #
updateMVar :: ( MonadSTM m, HasCallStack ) => StrictMVar m a -> (a -> (a, b)) -> m b Source #
updateMVar_ :: ( MonadSTM m, HasCallStack ) => StrictMVar m a -> (a -> a) -> m () Source #
modifyMVar :: ( MonadSTM m, MonadCatch m, HasCallStack ) => StrictMVar m a -> (a -> m (a, b)) -> m b Source #
modifyMVar_ :: ( MonadSTM m, MonadCatch m, HasCallStack ) => StrictMVar m a -> (a -> m a) -> m () Source #
newEmptyMVar :: ( MonadSTM m, NoThunks a) => a -> m ( StrictMVar m a) Source #
newMVar :: ( MonadSTM m, HasCallStack , NoThunks a) => a -> m ( StrictMVar m a) Source #
newTVar :: ( MonadSTM m, HasCallStack , NoThunks a) => a -> STM m ( StrictTVar m a) Source #
newTVarIO :: ( MonadSTM m, HasCallStack , NoThunks a) => a -> m ( StrictTVar m a) Source #
Temporary
uncheckedNewEmptyMVar :: MonadSTM m => a -> m ( StrictMVar m a) Source #
uncheckedNewMVar :: MonadSTM m => a -> m ( StrictMVar m a) Source #
uncheckedNewTVarM :: MonadSTM m => a -> m ( StrictTVar m a) Source #