conio
Safe HaskellNone
LanguageGHC2021

ConIO.MonadSTM

Synopsis

Documentation

class Monad m => MonadSTM (m :: Type -> Type) where Source #

MonadSTM is a class for all monads which can do STM actions.

Keep in mind that while some monads (e.g. IO) can do STM, your STM actions may not be executed atomically if you run them all in the IO monad. Keep them together in STM and then use one liftSTM to lift them to the IO monad.

Minimal complete definition

liftSTM

Methods

liftSTM :: STM a -> m a Source #

Lift STM into the monad m.

Keep in mind that liftSTM may lose atomicity. `liftSTM action1 >> liftSTM action2` might not be atomic, depending on the monad m. Use `liftSTM (action1 >> action2)` instead.

liftSTM_IO :: STM a -> IO a -> m a Source #

Lift an action which can be done in STM or in IO. This can be useful if the IO version is more performant.

Instances

Instances details
MonadSTM ConIO Source # 
Instance details

Defined in ConIO.Core

Methods

liftSTM :: STM a -> ConIO a Source #

liftSTM_IO :: STM a -> IO a -> ConIO a Source #

MonadSTM STM Source # 
Instance details

Defined in ConIO.MonadSTM

Methods

liftSTM :: STM a -> STM a Source #

liftSTM_IO :: STM a -> IO a -> STM a Source #

MonadSTM IO Source # 
Instance details

Defined in ConIO.MonadSTM

Methods

liftSTM :: STM a -> IO a Source #

liftSTM_IO :: STM a -> IO a -> IO a Source #

(MonadSTM m, MonadTrans t) => MonadSTM (t m) Source # 
Instance details

Defined in ConIO.MonadSTM

Methods

liftSTM :: STM a -> t m a Source #

liftSTM_IO :: STM a -> IO a -> t m a Source #