polysemy-0.6.0.0: Higher-order, low-boilerplate, zero-cost free monads.

Safe HaskellNone
LanguageHaskell2010

Polysemy.IO

Contents

Synopsis

Interpretations

runIO :: forall m r a. (MonadIO m, Member (Lift m) r) => Sem (Lift IO ': r) a -> Sem r a Source #

If you trying to run Sem in IO, the function you want is runM.

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 runIO.

Example

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

Since: 0.1.1.0

runEmbedded Source #

Arguments

:: (LastMember (Lift IO) r, MonadIO m) 
=> (forall x. m x -> IO x)

The means of running this monad.

-> Sem (Lift m ': r) a 
-> Sem r a 

Given some MonadIO m, interpret all Lift m actions in that monad at once. This is useful for interpreting effects like databases, which use their own monad for describing actions.

This function creates a thread, and so should be compiled with -threaded.

TODO(sandy): @since