monadio-unwrappable-0.1: Reversibly allow monad transformer stacks to run in IO

Safe HaskellSafe-Infered

Control.Monad.IO.Unwrappable

Description

Code in this module is not directly related to CellML, but it is rather convenience code used by the solver.

Synopsis

Documentation

class MonadIO m => MonadIOUnwrappable m c s | m -> c, m -> s whereSource

Represents a MonadIO where any change further up the monad stack can be | represented lower down in the stack.

Methods

unwrapState :: m sSource

Sets up state (e.g. an IORef) to be used to simulate the monad from the | IO monad.

unwrapMonadIO :: s -> m a -> IO (c a)Source

Maps the monad to only use IO level constructs and the state set up | using unwrapState.

rewrapMonadIO :: s -> c a -> m aSource

Reverses a previous unwrapMonadIO operation.

Instances

MonadIOUnwrappable IO Single () 
(MonadIO m, MonadIOUnwrappable m c s) => MonadIOUnwrappable (ReaderT r m) c (r, s) 
(MonadIO m, MonadIOUnwrappable m c s) => MonadIOUnwrappable (StateT r m) c (IORef r, s) 
(Error e, MonadIO m, MonadIOUnwrappable m c s) => MonadIOUnwrappable (ErrorT e m) (EitherChain c e) s