liftIO package:classy-prelude-conduit

Lift a computation from the IO monad.
Monads which allow their actions to be run in IO. While MonadIO allows an IO action to be lifted into another monad, this class captures the opposite concept: allowing you to capture the monadic context. Note that, in order to meet the laws given below, the intuition is that a monad must have no monadic state, but may have monadic context. This essentially limits MonadUnliftIO to ReaderT and IdentityT transformers on top of IO. Laws. For any value u returned by askUnliftIO, it must meet the monad transformer laws as reformulated for MonadUnliftIO:
  • unliftIO u . return = return
  • unliftIO u (m >>= f) = unliftIO u m >>= unliftIO
    u . f
The third is a currently nameless law which ensures that the current context is preserved.
  • askUnliftIO >>= (u -> liftIO (unliftIO u m)) =
    m
If you have a name for this, please submit it in a pull request for great glory.
Capture the current monadic context, providing the ability to run monadic actions in IO. See UnliftIO for an explanation of why we need a helper datatype here.