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

Safe Haskell | None
Language | Haskell2010

UnliftIO.STM

Contents

- Core
- TVar
- TMVar
- TChan
- TQueue
- TBQueue

Description

Lifted version of Control.Concurrent.STM

Since: 0.2.1.0

Synopsis

- data STM a
- atomically :: MonadIO m => STM a -> m a
- retrySTM :: STM a
- checkSTM :: Bool -> STM ()
- orElse :: STM a -> STM a -> STM a
- data TVar a
- newTVarIO :: MonadIO m => a -> m (TVar a)
- readTVarIO :: MonadIO m => TVar a -> m a
- newTVar :: a -> STM (TVar a)
- readTVar :: TVar a -> STM a
- writeTVar :: TVar a -> a -> STM ()
- modifyTVar :: TVar a -> (a -> a) -> STM ()
- modifyTVar' :: TVar a -> (a -> a) -> STM ()
- swapTVar :: TVar a -> a -> STM a
- registerDelay :: MonadIO m => Int -> m (TVar Bool)
- mkWeakTVar :: MonadUnliftIO m => TVar a -> m () -> m (Weak (TVar a))
- data TMVar a
- newTMVar :: a -> STM (TMVar a)
- newEmptyTMVar :: STM (TMVar a)
- newTMVarIO :: MonadIO m => a -> m (TMVar a)
- newEmptyTMVarIO :: MonadIO m => m (TMVar a)
- takeTMVar :: TMVar a -> STM a
- putTMVar :: TMVar a -> a -> STM ()
- readTMVar :: TMVar a -> STM a
- tryReadTMVar :: TMVar a -> STM (Maybe a)
- swapTMVar :: TMVar a -> a -> STM a
- tryTakeTMVar :: TMVar a -> STM (Maybe a)
- tryPutTMVar :: TMVar a -> a -> STM Bool
- isEmptyTMVar :: TMVar a -> STM Bool
- mkWeakTMVar :: MonadUnliftIO m => TMVar a -> m () -> m (Weak (TMVar a))
- data TChan a
- newTChan :: STM (TChan a)
- newTChanIO :: MonadIO m => m (TChan a)
- newBroadcastTChan :: STM (TChan a)
- newBroadcastTChanIO :: MonadIO m => m (TChan a)
- dupTChan :: TChan a -> STM (TChan a)
- cloneTChan :: TChan a -> STM (TChan a)
- readTChan :: TChan a -> STM a
- tryReadTChan :: TChan a -> STM (Maybe a)
- peekTChan :: TChan a -> STM a
- tryPeekTChan :: TChan a -> STM (Maybe a)
- writeTChan :: TChan a -> a -> STM ()
- unGetTChan :: TChan a -> a -> STM ()
- isEmptyTChan :: TChan a -> STM Bool
- data TQueue a
- newTQueue :: STM (TQueue a)
- newTQueueIO :: MonadIO m => m (TQueue a)
- readTQueue :: TQueue a -> STM a
- tryReadTQueue :: TQueue a -> STM (Maybe a)
- peekTQueue :: TQueue a -> STM a
- tryPeekTQueue :: TQueue a -> STM (Maybe a)
- writeTQueue :: TQueue a -> a -> STM ()
- unGetTQueue :: TQueue a -> a -> STM ()
- isEmptyTQueue :: TQueue a -> STM Bool
- data TBQueue a
- newTBQueue :: Natural -> STM (TBQueue a)
- newTBQueueIO :: MonadIO m => Natural -> m (TBQueue a)
- readTBQueue :: TBQueue a -> STM a
- tryReadTBQueue :: TBQueue a -> STM (Maybe a)
- peekTBQueue :: TBQueue a -> STM a
- tryPeekTBQueue :: TBQueue a -> STM (Maybe a)
- writeTBQueue :: TBQueue a -> a -> STM ()
- unGetTBQueue :: TBQueue a -> a -> STM ()
- isEmptyTBQueue :: TBQueue a -> STM Bool
- isFullTBQueue :: TBQueue a -> STM Bool

# Core

data STM a #

#### Instances

Instances details

Monad STM |
Instance details Defined in GHC.Conc.Sync Methods (>>=) :: STM a -> (a -> STM b) -> STM b (>>) :: STM a -> STM b -> STM b return :: a -> STM a
Functor STM |
Instance details Defined in GHC.Conc.Sync Methods fmap :: (a -> b) -> STM a -> STM b (<$) :: a -> STM b -> STM a
Applicative STM |
Instance details Defined in GHC.Conc.Sync Methods pure :: a -> STM a (<*>) :: STM (a -> b) -> STM a -> STM b liftA2 :: (a -> b -> c) -> STM a -> STM b -> STM c (*>) :: STM a -> STM b -> STM b (<*) :: STM a -> STM b -> STM a
Alternative STM |
Instance details Defined in GHC.Conc.Sync Methods empty :: STM a (<|>) :: STM a -> STM a -> STM a some :: STM a -> STM [a] many :: STM a -> STM [a]
MonadPlus STM |
Instance details Defined in GHC.Conc.Sync Methods mzero :: STM a mplus :: STM a -> STM a -> STM a
MArray TArray e STM |

Instance details

Defined in Control.Concurrent.STM.TArray

Methods

getBounds :: Ix i => TArray i e -> STM (i, i)

getNumElements :: Ix i => TArray i e -> STM Int

newArray :: Ix i => (i, i) -> e -> STM (TArray i e)

newArray_ :: Ix i => (i, i) -> STM (TArray i e)

unsafeNewArray_ :: Ix i => (i, i) -> STM (TArray i e)

unsafeRead :: Ix i => TArray i e -> Int -> STM e

unsafeWrite :: Ix i => TArray i e -> Int -> e -> STM ()

atomically :: MonadIO m => STM a -> m a Source #

Lifted version of `atomically`

Since: 0.2.1.0

retrySTM :: STM a Source #

Renamed `retry` for unqualified export

Since: 0.2.1.0

checkSTM :: Bool -> STM () Source #

Renamed `check` for unqualified export

Since: 0.2.1.0

orElse :: STM a -> STM a -> STM a #

# TVar

data TVar a #

#### Instances

Instances details

Eq (TVar a) |
Instance details Defined in GHC.Conc.Sync Methods (==) :: TVar a -> TVar a -> Bool (/=) :: TVar a -> TVar a -> Bool

newTVarIO :: MonadIO m => a -> m (TVar a) Source #

Lifted version of `newTVarIO`

Since: 0.2.1.0

readTVarIO :: MonadIO m => TVar a -> m a Source #

Lifted version of `readTVarIO`

Since: 0.2.1.0

newTVar :: a -> STM (TVar a) #

readTVar :: TVar a -> STM a #

writeTVar :: TVar a -> a -> STM () #

modifyTVar :: TVar a -> (a -> a) -> STM () #

modifyTVar' :: TVar a -> (a -> a) -> STM () #

swapTVar :: TVar a -> a -> STM a #

registerDelay :: MonadIO m => Int -> m (TVar Bool) Source #

Lifted version of `registerDelay`

Since: 0.2.1.0

mkWeakTVar :: MonadUnliftIO m => TVar a -> m () -> m (Weak (TVar a)) Source #

Lifted version of `mkWeakTVar`

Since: 0.2.1.0

# TMVar

data TMVar a #

#### Instances

Instances details

Eq (TMVar a) |
Instance details Defined in Control.Concurrent.STM.TMVar Methods (==) :: TMVar a -> TMVar a -> Bool (/=) :: TMVar a -> TMVar a -> Bool

newTMVar :: a -> STM (TMVar a) #

newEmptyTMVar :: STM (TMVar a) #

newTMVarIO :: MonadIO m => a -> m (TMVar a) Source #

Lifted version of `newTMVarIO`

Since: 0.2.1.0

newEmptyTMVarIO :: MonadIO m => m (TMVar a) Source #

Lifted version of `newEmptyTMVarIO`

Since: 0.2.1.0

takeTMVar :: TMVar a -> STM a #

putTMVar :: TMVar a -> a -> STM () #

readTMVar :: TMVar a -> STM a #

tryReadTMVar :: TMVar a -> STM (Maybe a) #

swapTMVar :: TMVar a -> a -> STM a #

tryTakeTMVar :: TMVar a -> STM (Maybe a) #

tryPutTMVar :: TMVar a -> a -> STM Bool #

isEmptyTMVar :: TMVar a -> STM Bool #

mkWeakTMVar :: MonadUnliftIO m => TMVar a -> m () -> m (Weak (TMVar a)) Source #

Lifted version of `mkWeakTMVar`

Since: 0.2.1.0

# TChan

data TChan a #

#### Instances

Instances details

Eq (TChan a) |
Instance details Defined in Control.Concurrent.STM.TChan Methods (==) :: TChan a -> TChan a -> Bool (/=) :: TChan a -> TChan a -> Bool

newTChan :: STM (TChan a) #

newTChanIO :: MonadIO m => m (TChan a) Source #

Lifted version of `newTChanIO`

Since: 0.2.1.0

newBroadcastTChan :: STM (TChan a) #

newBroadcastTChanIO :: MonadIO m => m (TChan a) Source #

Lifted version of `newBroadcastTChanIO`

Since: 0.2.1.0

dupTChan :: TChan a -> STM (TChan a) #

cloneTChan :: TChan a -> STM (TChan a) #

readTChan :: TChan a -> STM a #

tryReadTChan :: TChan a -> STM (Maybe a) #

peekTChan :: TChan a -> STM a #

tryPeekTChan :: TChan a -> STM (Maybe a) #

writeTChan :: TChan a -> a -> STM () #

unGetTChan :: TChan a -> a -> STM () #

isEmptyTChan :: TChan a -> STM Bool #

# TQueue

data TQueue a #

#### Instances

Instances details

Eq (TQueue a) |
Instance details Defined in Control.Concurrent.STM.TQueue Methods (==) :: TQueue a -> TQueue a -> Bool (/=) :: TQueue a -> TQueue a -> Bool

newTQueue :: STM (TQueue a) #

newTQueueIO :: MonadIO m => m (TQueue a) Source #

Lifted version of `newTQueueIO`

Since: 0.2.1.0

readTQueue :: TQueue a -> STM a #

tryReadTQueue :: TQueue a -> STM (Maybe a) #

peekTQueue :: TQueue a -> STM a #

tryPeekTQueue :: TQueue a -> STM (Maybe a) #

writeTQueue :: TQueue a -> a -> STM () #

unGetTQueue :: TQueue a -> a -> STM () #

isEmptyTQueue :: TQueue a -> STM Bool #

# TBQueue

data TBQueue a #

#### Instances

Instances details

Eq (TBQueue a) |
Instance details Defined in Control.Concurrent.STM.TBQueue Methods (==) :: TBQueue a -> TBQueue a -> Bool (/=) :: TBQueue a -> TBQueue a -> Bool

newTBQueue :: Natural -> STM (TBQueue a) #

newTBQueueIO :: MonadIO m => Natural -> m (TBQueue a) Source #

Lifted version of `newTBQueueIO`

Since: 0.2.1.0

readTBQueue :: TBQueue a -> STM a #

tryReadTBQueue :: TBQueue a -> STM (Maybe a) #

peekTBQueue :: TBQueue a -> STM a #

tryPeekTBQueue :: TBQueue a -> STM (Maybe a) #

writeTBQueue :: TBQueue a -> a -> STM () #

unGetTBQueue :: TBQueue a -> a -> STM () #

isEmptyTBQueue :: TBQueue a -> STM Bool #

isFullTBQueue :: TBQueue a -> STM Bool #