| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Control.Effect.Embed
Synopsis
- newtype Embed b (m :: * -> *) a where
- embed :: Eff (Embed b) m => b a -> m a
- runM :: Monad m => RunMC m a -> m a
- runEmbed :: Carrier m => EmbedC m a -> m a
- embedToEmbed :: forall b b' m a. Eff (Embed b') m => (forall x. b x -> b' x) -> InterpretReifiedC (Embed b) m a -> m a
- embedToMonadBase :: (MonadBase b m, Carrier m) => EmbedToMonadBaseC b m a -> m a
- embedToMonadIO :: (MonadIO m, Carrier m) => EmbedToMonadIOC m a -> m a
- 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
- newtype RunMC m a = RunMC (m a)
- newtype EmbedC m a = EmbedC (m a)
- type EmbedToMonadBaseC b = InterpretC EmbedToMonadBaseH (Embed b)
- type EmbedToMonadIOC = InterpretC EmbedToMonadIOH (Embed IO)
Effects
newtype Embed b (m :: * -> *) a where Source #
An effect for embedding actions of a base monad into the current one.
Actions
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 effect if Embed bb is the base of the current
monad m.
embedToMonadIO :: (MonadIO m, Carrier m) => EmbedToMonadIOC m a -> m a Source #
Run an effect if the current monad Embed IOm 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
Constructors
| RunMC (m a) |
Instances
Constructors
| EmbedC (m a) |
Instances
type EmbedToMonadBaseC b = InterpretC EmbedToMonadBaseH (Embed b) Source #
type EmbedToMonadIOC = InterpretC EmbedToMonadIOH (Embed IO) Source #