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

Safe HaskellSafe-Infered



Contains a class and instance for MonadIO implementations that can be run directly in MonadIO and | then reconstructed to the original type, without changing the overall semantics.



class MonadIO m => MonadIOUnwrappable m whereSource

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


unwrapState :: m (MonadIOStateType m)Source

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

unwrapMonadIO :: MonadIOStateType m -> m a -> IO (MonadIOWrapType m a)Source

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

rewrapMonadIO :: MonadIOStateType m -> MonadIOWrapType m a -> m aSource

Reverses a previous unwrapMonadIO operation.