in-other-words-0.1.0.0: A higher-order effect system where the sky's the limit

Control.Effect.Embed

Synopsis

# Effects

newtype Embed b m a where Source #

An effect for embedding actions of a base monad into the current one.

Constructors

 Embed Fields:: { unEmbed :: b a    } -> Embed b m a

# Actions

embed :: Eff (Embed b) m => b a -> m a Source #

# Interpreters

runM :: Monad m => RunMC m a -> m a Source #

Extract the final monad m from a computation of which no effects remain to be handled except for Embed m.

embedToEmbed :: forall b b' m a. Eff (Embed b') m => (forall x. b x -> b' x) -> InterpretReifiedC (Embed b) m a -> m a Source #

Transform an Embed effect into another Embed effect by providing a natural transformation to convert monadic values of one monad to the other.

This has a higher-rank type, as it makes use of InterpretReifiedC. This makes embedToEmbed very difficult to use partially applied. In particular, it can't be composed using ..

If performance is secondary, consider using the slower embedToEmbedSimple, which doesn't have a higher-rank type.

embedToMonadBase :: (MonadBase b m, Carrier m) => EmbedToMonadBaseC b m a -> m a Source #

Run an Embed b effect if b is the base of the current monad m.

Run an Embed IO effect if the current monad m is a MonadIO.

# Simple variants

embedToEmbedSimple :: forall b b' m a p. (Eff (Embed b') m, Threaders '[ReaderThreads] m p) => (forall x. b x -> b' x) -> InterpretSimpleC (Embed b) m a -> m a Source #

Transform an Embed effect into another Embed effect by providing a natural transformation to convert monadic values of one monad to the other.

This is a less performant version of embedToEmbed that doesn't have a higher-rank type, making it much easier to use partially applied.

# Carriers

newtype RunMC m a Source #

The carrier for runM, which carries no effects but Embed m.

Constructors

 RunMC (m a)

#### Instances

Instances details