HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulepolysemy-1.9.2.0Haskell2010

Polysemy.IO

  • 1 value
  • Packagepolysemy-1.9.2.0
  • Exports1
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceIO.hs

Interpretations

1 declaration
valueembedToMonadIO
  1. :: (MonadIO m, Member (Embed m) r)
  2. => Sem (Embed IO ': r) a
  3. -> Sem r a
#

The MonadIO class is conceptually an interpretation of IO to some other monad. This function reifies that intuition, by transforming an IO effect into some other MonadIO.

This function is especially useful when using the MonadIO instance for Sem instance.

Make sure to type-apply the desired MonadIO instance when using embedToMonadIO.

Example
foo :: PandocIO ()
foo = runM . embedToMonadIO @PandocIO $ do
  liftIO $ putStrLn "hello from polysemy"