Copyright | (c) Michael Szvetits 2020 |
---|---|
License | BSD3 (see the file LICENSE) |
Maintainer | typedbyte@qualified.name |
Stability | stable |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
The embed effect for integrating arbitrary monads into the effect system.
Synopsis
- class Monad m => Embed n m where
- embed :: n a -> m a
- data Transformation n t m a
- runEmbed :: (forall b. n b -> t b) -> (Embed n `Via` Transformation n t) m a -> m a
Embed Effect
class Monad m => Embed n m where Source #
An effect that integrates a monad n
into the computation m
.
Instances
Monad m => Embed m m Source # | |
Defined in Control.Effect.Embed | |
Lift (Embed n) t m => Embed n (Via eff t m) Source # | |
Defined in Control.Effect.Embed | |
Handle (Embed n) t m => Embed n (Via (Embed n) t m) Source # | |
Embed t m => Embed n (Transformation n t m) Source # | |
Defined in Control.Effect.Embed embed :: n a -> Transformation n t m a Source # |
Interpretations
data Transformation n t m a Source #
The transformation interpreter of the embed effect. This type implements the
Embed
type class by transforming the integrated monad n
into another
integrated monad t
via natural transformation.
When interpreting the effect, you usually don't interact with this type directly, but instead use one of its corresponding interpretation functions.
Instances
:: (forall b. n b -> t b) | The natural transformation from monad |
-> (Embed n `Via` Transformation n t) m a | The program whose embed effect should be handled. |
-> m a | The program with its embed effect handled. |
Runs the embed effect by transforming the integrated monad n
into another
integrated monad t
.