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

Control.Concurrent.Class.MonadMVar

Synopsis

Documentation

class Monad m => MonadMVar m where Source #

Associated Types

type MVar m :: Type -> Type Source #

Methods

newEmptyMVar :: m (MVar m a) Source #

takeMVar :: MVar m a -> m a Source #

putMVar :: MVar m a -> a -> m () Source #

See putMVar.

tryTakeMVar :: MVar m a -> m (Maybe a) Source #

tryPutMVar :: MVar m a -> a -> m Bool Source #

isEmptyMVar :: MVar m a -> m Bool Source #

newMVar :: a -> m (MVar m a) Source #

See newMVar.

default newMVar :: a -> m (MVar m a) Source #

readMVar :: MVar m a -> m a Source #

tryReadMVar :: MVar m a -> m (Maybe a) Source #

swapMVar :: MVar m a -> a -> m a Source #

default swapMVar :: MonadMask m => MVar m a -> a -> m a Source #

withMVar :: MVar m a -> (a -> m b) -> m b Source #

default withMVar :: MonadMask m => MVar m a -> (a -> m b) -> m b Source #

withMVarMasked :: MVar m a -> (a -> m b) -> m b Source #

default withMVarMasked :: MonadMask m => MVar m a -> (a -> m b) -> m b Source #

modifyMVar_ :: MVar m a -> (a -> m a) -> m () Source #

default modifyMVar_ :: MonadMask m => MVar m a -> (a -> m a) -> m () Source #

modifyMVar :: MVar m a -> (a -> m (a, b)) -> m b Source #

default modifyMVar :: (MonadMask m, MonadEvaluate m) => MVar m a -> (a -> m (a, b)) -> m b Source #

modifyMVarMasked_ :: MVar m a -> (a -> m a) -> m () Source #

default modifyMVarMasked_ :: MonadMask m => MVar m a -> (a -> m a) -> m () Source #

modifyMVarMasked :: MVar m a -> (a -> m (a, b)) -> m b Source #

default modifyMVarMasked :: (MonadMask m, MonadEvaluate m) => MVar m a -> (a -> m (a, b)) -> m b Source #

Instances

Instances details
MonadMVar IO Source # 
Instance details

Defined in Control.Concurrent.Class.MonadMVar

Associated Types

type MVar IO :: Type -> Type Source #

Methods

newEmptyMVar :: IO (MVar IO a) Source #

takeMVar :: MVar IO a -> IO a Source #

putMVar :: MVar IO a -> a -> IO () Source #

tryTakeMVar :: MVar IO a -> IO (Maybe a) Source #

tryPutMVar :: MVar IO a -> a -> IO Bool Source #

isEmptyMVar :: MVar IO a -> IO Bool Source #

newMVar :: a -> IO (MVar IO a) Source #

readMVar :: MVar IO a -> IO a Source #

tryReadMVar :: MVar IO a -> IO (Maybe a) Source #

swapMVar :: MVar IO a -> a -> IO a Source #

withMVar :: MVar IO a -> (a -> IO b) -> IO b Source #

withMVarMasked :: MVar IO a -> (a -> IO b) -> IO b Source #

modifyMVar_ :: MVar IO a -> (a -> IO a) -> IO () Source #

modifyMVar :: MVar IO a -> (a -> IO (a, b)) -> IO b Source #

modifyMVarMasked_ :: MVar IO a -> (a -> IO a) -> IO () Source #

modifyMVarMasked :: MVar IO a -> (a -> IO (a, b)) -> IO b Source #

(MonadMask m, MonadMVar m) => MonadMVar (ReaderT r m) Source # 
Instance details

Defined in Control.Concurrent.Class.MonadMVar

Associated Types

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

Methods

newEmptyMVar :: ReaderT r m (MVar (ReaderT r m) a) Source #

takeMVar :: MVar (ReaderT r m) a -> ReaderT r m a Source #

putMVar :: MVar (ReaderT r m) a -> a -> ReaderT r m () Source #

tryTakeMVar :: MVar (ReaderT r m) a -> ReaderT r m (Maybe a) Source #

tryPutMVar :: MVar (ReaderT r m) a -> a -> ReaderT r m Bool Source #

isEmptyMVar :: MVar (ReaderT r m) a -> ReaderT r m Bool Source #

newMVar :: a -> ReaderT r m (MVar (ReaderT r m) a) Source #

readMVar :: MVar (ReaderT r m) a -> ReaderT r m a Source #

tryReadMVar :: MVar (ReaderT r m) a -> ReaderT r m (Maybe a) Source #

swapMVar :: MVar (ReaderT r m) a -> a -> ReaderT r m a Source #

withMVar :: MVar (ReaderT r m) a -> (a -> ReaderT r m b) -> ReaderT r m b Source #

withMVarMasked :: MVar (ReaderT r m) a -> (a -> ReaderT r m b) -> ReaderT r m b Source #

modifyMVar_ :: MVar (ReaderT r m) a -> (a -> ReaderT r m a) -> ReaderT r m () Source #

modifyMVar :: MVar (ReaderT r m) a -> (a -> ReaderT r m (a, b)) -> ReaderT r m b Source #

modifyMVarMasked_ :: MVar (ReaderT r m) a -> (a -> ReaderT r m a) -> ReaderT r m () Source #

modifyMVarMasked :: MVar (ReaderT r m) a -> (a -> ReaderT r m (a, b)) -> ReaderT r m b Source #

class (MonadMVar m, Monad (InspectMVarMonad m)) => MonadInspectMVar m where Source #

This type class is intended for 'io-sim', where one might want to access an MVar in the underlying ST monad.

Associated Types

type InspectMVarMonad m :: Type -> Type Source #

Methods

inspectMVar :: proxy m -> MVar m a -> InspectMVarMonad m (Maybe a) Source #

Return the value of an MVar as an InspectMVarMonad computation. Can be Nothing if the MVar is empty.

Instances

Instances details
MonadInspectMVar IO Source # 
Instance details

Defined in Control.Concurrent.Class.MonadMVar

Associated Types

type InspectMVarMonad IO :: Type -> Type Source #

Methods

inspectMVar :: proxy IO -> MVar IO a -> InspectMVarMonad IO (Maybe a) Source #