unlift-stm-0.1.0.0: (un)lifted classes and functions for the STM monad
Stabilityexperimental
Safe HaskellSafe-Inferred
LanguageHaskell2010

Control.Monad.STM.Unlift

Description

A typeclass which abstracts over monads that can be "unlifted" back down to STM. (This is essentially a copy of Control.Monad.IO.Unlift, modified for the STM monad.)

In a manner that is analagous to MonadUnliftIO, instances of this typeclass are essentially limited to:

Synopsis

Documentation

class MonadSTM m => MonadUnliftSTM m where Source #

Analagous to MonadUnliftIO. (It is an abstraction for monads that can be "unlifted" back down to the STM monad.)

Minimal complete definition

askUnliftSTM | withRunInSTM

Methods

askUnliftSTM :: m (UnliftSTM m) Source #

withRunInSTM :: ((forall a. m a -> STM a) -> STM b) -> m b Source #

Instances

Instances details
MonadUnliftSTM STM Source # 
Instance details

Defined in Control.Monad.STM.Unlift

Methods

askUnliftSTM :: STM (UnliftSTM STM) Source #

withRunInSTM :: ((forall a. STM a -> STM a) -> STM b) -> STM b Source #

MonadUnliftSTM m => MonadUnliftSTM (ReaderT r m) Source # 
Instance details

Defined in Control.Monad.STM.Unlift

Methods

askUnliftSTM :: ReaderT r m (UnliftSTM (ReaderT r m)) Source #

withRunInSTM :: ((forall a. ReaderT r m a -> STM a) -> STM b) -> ReaderT r m b Source #

MonadUnliftSTM m => MonadUnliftSTM (IdentityT m) Source # 
Instance details

Defined in Control.Monad.STM.Unlift

Methods

askUnliftSTM :: IdentityT m (UnliftSTM (IdentityT m)) Source #

withRunInSTM :: ((forall a. IdentityT m a -> STM a) -> STM b) -> IdentityT m b Source #

newtype UnliftSTM m Source #

Analagous to UnliftIO

Constructors

UnliftSTM 

Fields

askRunInSTM :: MonadUnliftSTM m => m (m a -> STM a) Source #

Analagous to askRunInIO

withUnliftSTM :: MonadUnliftSTM m => (UnliftSTM m -> STM a) -> m a Source #

Analagous to withUnliftIO

toSTM :: MonadUnliftSTM m => m a -> m (STM a) Source #

Analagous to toIO