lifted-base-0.2.3.11: lifted IO operations from the base library

Copyright | Bas van Dijk
License | BSD-style
Maintainer | Bas van Dijk <v.dijk.bas@gmail.com>
Stability | experimental
Safe Haskell | Safe
Language | Haskell98

Control.Concurrent.MVar.Lifted

Description

This is a wrapped version of Control.Concurrent.MVar with types generalized from `IO` to all monads in either `MonadBase` or `MonadBaseControl`.

Synopsis

- data MVar a :: * -> *
- newEmptyMVar :: MonadBase IO m => m (MVar a)
- newMVar :: MonadBase IO m => a -> m (MVar a)
- takeMVar :: MonadBase IO m => MVar a -> m a
- putMVar :: MonadBase IO m => MVar a -> a -> m ()
- readMVar :: MonadBase IO m => MVar a -> m a
- swapMVar :: MonadBase IO m => MVar a -> a -> m a
- tryTakeMVar :: MonadBase IO m => MVar a -> m (Maybe a)
- tryPutMVar :: MonadBase IO m => MVar a -> a -> m Bool
- isEmptyMVar :: MonadBase IO m => MVar a -> m Bool
- withMVar :: MonadBaseControl IO m => MVar a -> (a -> m b) -> m b
- modifyMVar_ :: MonadBaseControl IO m => MVar a -> (a -> m a) -> m ()
- modifyMVar :: MonadBaseControl IO m => MVar a -> (a -> m (a, b)) -> m b
- modifyMVarMasked_ :: MonadBaseControl IO m => MVar a -> (a -> m a) -> m ()
- modifyMVarMasked :: MonadBaseControl IO m => MVar a -> (a -> m (a, b)) -> m b
- mkWeakMVar :: MonadBaseControl IO m => MVar a -> m () -> m (Weak (MVar a))
- withMVarMasked :: MonadBaseControl IO m => MVar a -> (a -> m b) -> m b
- tryReadMVar :: MonadBase IO m => MVar a -> m (Maybe 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 a box, which may be empty or full.

Instances

Eq (MVar a) |
Methods (==) :: MVar a -> MVar a -> Bool # (/=) :: MVar a -> MVar a -> Bool #

newEmptyMVar :: MonadBase IO m => m (MVar a) #

Generalized version of `newEmptyMVar`.

newMVar :: MonadBase IO m => a -> m (MVar a) #

Generalized version of `newMVar`.

takeMVar :: MonadBase IO m => MVar a -> m a #

Generalized version of `takeMVar`.

putMVar :: MonadBase IO m => MVar a -> a -> m () #

Generalized version of `putMVar`.

readMVar :: MonadBase IO m => MVar a -> m a #

Generalized version of `readMVar`.

swapMVar :: MonadBase IO m => MVar a -> a -> m a #

Generalized version of `swapMVar`.

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

Generalized version of `tryTakeMVar`.

tryPutMVar :: MonadBase IO m => MVar a -> a -> m Bool #

Generalized version of `tryPutMVar`.

isEmptyMVar :: MonadBase IO m => MVar a -> m Bool #

Generalized version of `isEmptyMVar`.

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

Generalized version of `withMVar`.

modifyMVar_ :: MonadBaseControl IO m => MVar a -> (a -> m a) -> m () #

Generalized version of `modifyMVar_`.

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

Generalized version of `modifyMVar`.

modifyMVarMasked_ :: MonadBaseControl IO m => MVar a -> (a -> m a) -> m () #

Generalized version of `modifyMVarMasked_`.

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

Generalized version of `modifyMVarMasked`.

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

Generalized version of `mkWeakMVar`.

Note any monadic side effects in `m` of the "finalizer" computation are discarded.

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

Generalized version of `withMVarMasked`.

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

Generalized version of `tryReadMVar`.