Documentation

Hale.UnliftIO.Control.Monad.IO.Unlift

Typeclass for monads that can "unlift" back to IO.

$$\text{withRunInIO} : ((\forall \alpha.\; m\;\alpha \to \text{IO}\;\alpha) \to \text{IO}\;\beta) \to m\;\beta$$

This enables running callbacks that require plain IO from within a monadic context m. The CPS form avoids universe issues with returning the polymorphic run function directly.

  • withRunInIO {β : Type} : (((α : Type) → m αIO α)IO β)m β

    Provide a function to run m actions in IO.

Instances
    @[inline]
    def Control.Monad.IO.MonadUnliftIO.toIO {m : TypeType} {α : Type} [Monad m] [MonadLiftT IO m] [MonadUnliftIO m] (act : m α) :
    m (IO α)

    Convenience: run a single m action in IO. $$\text{toIO}(act) : m\;(\text{IO}\;\alpha)$$

    Equations
    Instances For
      @[inline]
      def Control.Monad.IO.MonadUnliftIO.liftIOOp {m : TypeType} {α β : Type} [Monad m] [MonadLiftT IO m] [MonadUnliftIO m] (f : (IO αIO α)IO β) (act : m α) :
      m β

      Lift an IO-expecting callback into m by providing the unlift. $$\text{liftIOOp} : ((\text{IO}\;\alpha \to \text{IO}\;\alpha) \to \text{IO}\;\beta) \to m\;\alpha \to m\;\beta$$

      Equations
      Instances For
        @[implicit_reducible]

        IO trivially unlifts to itself: the run function is id.

        Equations
        @[implicit_reducible]

        ReaderT r IO can unlift by capturing the environment.

        Equations
        • One or more equations did not get rendered due to their size.