Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
This module corresponds to Control.Concurrent.MVar in the base
package.
Synopsis
- data StrictMVar m a
- type LazyMVar m = MVar m
- castStrictMVar :: LazyMVar m ~ LazyMVar n => StrictMVar m a -> StrictMVar n a
- toLazyMVar :: StrictMVar m a -> LazyMVar m a
- fromLazyMVar :: MVar m a -> StrictMVar m a
- newEmptyMVar :: MonadMVar m => m (StrictMVar m a)
- newMVar :: MonadMVar m => a -> m (StrictMVar m a)
- takeMVar :: MonadMVar m => StrictMVar m a -> m a
- putMVar :: MonadMVar m => StrictMVar m a -> a -> m ()
- readMVar :: MonadMVar m => StrictMVar m a -> m a
- swapMVar :: MonadMVar m => StrictMVar m a -> a -> m a
- tryTakeMVar :: MonadMVar m => StrictMVar m a -> m (Maybe a)
- tryPutMVar :: MonadMVar m => StrictMVar m a -> a -> m Bool
- isEmptyMVar :: MonadMVar m => StrictMVar m a -> m Bool
- withMVar :: MonadMVar m => StrictMVar m a -> (a -> m b) -> m b
- withMVarMasked :: MonadMVar m => StrictMVar m a -> (a -> m b) -> m b
- modifyMVar_ :: MonadMVar m => StrictMVar m a -> (a -> m a) -> m ()
- modifyMVar :: MonadMVar m => StrictMVar m a -> (a -> m (a, b)) -> m b
- modifyMVarMasked_ :: MonadMVar m => StrictMVar m a -> (a -> m a) -> m ()
- modifyMVarMasked :: MonadMVar m => StrictMVar m a -> (a -> m (a, b)) -> m b
- tryReadMVar :: MonadMVar m => StrictMVar m a -> m (Maybe a)
- class Monad m => MonadMVar (m :: Type -> Type)
StrictMVar
data StrictMVar m a Source #
castStrictMVar :: LazyMVar m ~ LazyMVar n => StrictMVar m a -> StrictMVar n a Source #
toLazyMVar :: StrictMVar m a -> LazyMVar m a Source #
Get the underlying MVar
Since we obviously cannot guarantee that updates to this LazyMVar
will be
strict, this should be used with caution.
fromLazyMVar :: MVar m a -> StrictMVar m a Source #
Create a StrictMVar
from a LazyMVar
It is not guaranteed that the LazyMVar
contains a value that is in WHNF, so
there is no guarantee that the resulting StrictMVar
contains a value that
is in WHNF. This should be used with caution.
newEmptyMVar :: MonadMVar m => m (StrictMVar m a) Source #
newMVar :: MonadMVar m => a -> m (StrictMVar m a) Source #
takeMVar :: MonadMVar m => StrictMVar m a -> m a Source #
putMVar :: MonadMVar m => StrictMVar m a -> a -> m () Source #
readMVar :: MonadMVar m => StrictMVar m a -> m a Source #
swapMVar :: MonadMVar m => StrictMVar m a -> a -> m a Source #
tryTakeMVar :: MonadMVar m => StrictMVar m a -> m (Maybe a) Source #
tryPutMVar :: MonadMVar m => StrictMVar m a -> a -> m Bool Source #
isEmptyMVar :: MonadMVar m => StrictMVar m a -> m Bool Source #
withMVar :: MonadMVar m => StrictMVar m a -> (a -> m b) -> m b Source #
withMVarMasked :: MonadMVar m => StrictMVar m a -> (a -> m b) -> m b Source #
modifyMVar_ :: MonadMVar m => StrictMVar m a -> (a -> m a) -> m () Source #
modifyMVar :: MonadMVar m => StrictMVar m a -> (a -> m (a, b)) -> m b Source #
modifyMVarMasked_ :: MonadMVar m => StrictMVar m a -> (a -> m a) -> m () Source #
modifyMVarMasked :: MonadMVar m => StrictMVar m a -> (a -> m (a, b)) -> m b Source #
tryReadMVar :: MonadMVar m => StrictMVar m a -> m (Maybe a) Source #
Re-exports
class Monad m => MonadMVar (m :: Type -> Type) #
newEmptyMVar, takeMVar, tryTakeMVar, putMVar, tryPutMVar, readMVar, tryReadMVar, isEmptyMVar
Instances
MonadMVar IO | |
Defined in Control.Concurrent.Class.MonadMVar newEmptyMVar :: IO (MVar IO a) putMVar :: MVar IO a -> a -> IO () tryTakeMVar :: MVar IO a -> IO (Maybe a) tryPutMVar :: MVar IO a -> a -> IO Bool isEmptyMVar :: MVar IO a -> IO Bool newMVar :: a -> IO (MVar IO a) tryReadMVar :: MVar IO a -> IO (Maybe a) swapMVar :: MVar IO a -> a -> IO a withMVar :: MVar IO a -> (a -> IO b) -> IO b withMVarMasked :: MVar IO a -> (a -> IO b) -> IO b modifyMVar_ :: MVar IO a -> (a -> IO a) -> IO () modifyMVar :: MVar IO a -> (a -> IO (a, b)) -> IO b modifyMVarMasked_ :: MVar IO a -> (a -> IO a) -> IO () modifyMVarMasked :: MVar IO a -> (a -> IO (a, b)) -> IO b | |
(MonadMask m, MonadMVar m) => MonadMVar (ReaderT r m) | |
Defined in Control.Concurrent.Class.MonadMVar newEmptyMVar :: ReaderT r m (MVar (ReaderT r m) a) takeMVar :: MVar (ReaderT r m) a -> ReaderT r m a putMVar :: MVar (ReaderT r m) a -> a -> ReaderT r m () tryTakeMVar :: MVar (ReaderT r m) a -> ReaderT r m (Maybe a) tryPutMVar :: MVar (ReaderT r m) a -> a -> ReaderT r m Bool isEmptyMVar :: MVar (ReaderT r m) a -> ReaderT r m Bool newMVar :: a -> ReaderT r m (MVar (ReaderT r m) a) readMVar :: MVar (ReaderT r m) a -> ReaderT r m a tryReadMVar :: MVar (ReaderT r m) a -> ReaderT r m (Maybe a) swapMVar :: MVar (ReaderT r m) a -> a -> ReaderT r m a withMVar :: MVar (ReaderT r m) a -> (a -> ReaderT r m b) -> ReaderT r m b withMVarMasked :: MVar (ReaderT r m) a -> (a -> ReaderT r m b) -> ReaderT r m b modifyMVar_ :: MVar (ReaderT r m) a -> (a -> ReaderT r m a) -> ReaderT r m () modifyMVar :: MVar (ReaderT r m) a -> (a -> ReaderT r m (a, b)) -> ReaderT r m b modifyMVarMasked_ :: MVar (ReaderT r m) a -> (a -> ReaderT r m a) -> ReaderT r m () modifyMVarMasked :: MVar (ReaderT r m) a -> (a -> ReaderT r m (a, b)) -> ReaderT r m b |