unliftio-0.2.25.0: The MonadUnliftIO typeclass for unlifting monads to IO (batteries included)

Safe Haskell | Safe-Inferred
Language | Haskell2010

UnliftIO.MVar

Description

Unlifted Control.Concurrent.MVar.

Since: 0.1.0.0

Synopsis

- data MVar a
- newEmptyMVar :: MonadIO m => m (MVar a)
- newMVar :: MonadIO m => a -> m (MVar a)
- takeMVar :: MonadIO m => MVar a -> m a
- putMVar :: MonadIO m => MVar a -> a -> m ()
- readMVar :: MonadIO m => MVar a -> m a
- swapMVar :: MonadIO m => MVar a -> a -> m a
- tryTakeMVar :: MonadIO m => MVar a -> m (Maybe a)
- tryPutMVar :: MonadIO m => MVar a -> a -> m Bool
- isEmptyMVar :: MonadIO m => MVar a -> m Bool
- withMVar :: MonadUnliftIO m => MVar a -> (a -> m b) -> m b
- withMVarMasked :: MonadUnliftIO m => MVar a -> (a -> m b) -> m b
- modifyMVar :: MonadUnliftIO m => MVar a -> (a -> m (a, b)) -> m b
- modifyMVar_ :: MonadUnliftIO m => MVar a -> (a -> m a) -> m ()
- modifyMVarMasked :: MonadUnliftIO m => MVar a -> (a -> m (a, b)) -> m b
- modifyMVarMasked_ :: MonadUnliftIO m => MVar a -> (a -> m a) -> m ()
- tryReadMVar :: MonadIO m => MVar a -> m (Maybe a)
- mkWeakMVar :: MonadUnliftIO m => MVar a -> m () -> m (Weak (MVar a))

# Documentation

data MVar a #

An `MVar` (pronounced "em-var") is a synchronising variable, used for communication between concurrent threads. It can be thought of as a box, which may be empty or full.

#### Instances

Instances details

NFData1 MVar | Since: deepseq-1.4.3.0
Instance details Defined in Control.DeepSeq Methods liftRnf :: (a -> ()) -> MVar a -> () #
NFData (MVar a) | NOTE: Only strict in the reference and not the referenced value. Since: deepseq-1.4.2.0
Instance details Defined in Control.DeepSeq Methods rnf :: MVar a -> () #
Eq (MVar a) | Since: base-4.1.0.0
Instance details Defined in GHC.MVar Methods (==) :: MVar a -> MVar a -> Bool # (/=) :: MVar a -> MVar a -> Bool #

newEmptyMVar :: MonadIO m => m (MVar a) #

Lifted `newEmptyMVar`.

Since: 0.1.0.0

newMVar :: MonadIO m => a -> m (MVar a) #

Lifted `newMVar`.

Since: 0.1.0.0

takeMVar :: MonadIO m => MVar a -> m a #

Lifted `takeMVar`.

Since: 0.1.0.0

putMVar :: MonadIO m => MVar a -> a -> m () #

Lifted `putMVar`.

Since: 0.1.0.0

readMVar :: MonadIO m => MVar a -> m a #

Lifted `readMVar`.

Since: 0.1.0.0

swapMVar :: MonadIO m => MVar a -> a -> m a #

Lifted `swapMVar`.

Since: 0.1.0.0

tryTakeMVar :: MonadIO m => MVar a -> m (Maybe a) #

Lifted `tryTakeMVar`.

Since: 0.1.0.0

tryPutMVar :: MonadIO m => MVar a -> a -> m Bool #

Lifted `tryPutMVar`.

Since: 0.1.0.0

isEmptyMVar :: MonadIO m => MVar a -> m Bool #

Lifted `isEmptyMVar`.

Since: 0.1.0.0

withMVar :: MonadUnliftIO m => MVar a -> (a -> m b) -> m b #

Unlifted `withMVar`.

Since: 0.1.0.0

withMVarMasked :: MonadUnliftIO m => MVar a -> (a -> m b) -> m b #

Unlifted `withMVarMasked`.

Since: 0.1.0.0

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

Unlifted `modifyMVar`.

Since: 0.1.0.0

modifyMVar_ :: MonadUnliftIO m => MVar a -> (a -> m a) -> m () #

Unlifted `modifyMVar_`.

Since: 0.1.0.0

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

Unlifted `modifyMVarMasked`.

Since: 0.1.0.0

modifyMVarMasked_ :: MonadUnliftIO m => MVar a -> (a -> m a) -> m () #

Unlifted `modifyMVarMasked_`.

Since: 0.1.0.0

tryReadMVar :: MonadIO m => MVar a -> m (Maybe a) #

Lifted `tryReadMVar`.

Since: 0.1.0.0

mkWeakMVar :: MonadUnliftIO m => MVar a -> m () -> m (Weak (MVar a)) #

Unlifted `mkWeakMVar`.

Since: 0.1.0.0