Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Bundle r m a where
- sendBundle :: forall e r' r a. (Member e r', Member (Bundle r') r) => Sem (e ': r) a -> Sem r a
- injBundle :: forall e r m a. Member e r => e m a -> Bundle r m a
- runBundle :: forall r' r a. KnownList r' => Sem (Bundle r' ': r) a -> Sem (Append r' r) a
- subsumeBundle :: forall r' r a. Members r' r => Sem (Bundle r' ': r) a -> Sem r a
- class KnownList (l :: [k])
Effect
data Bundle r m a where Source #
An effect for collecting multiple effects into one effect.
Useful for effect newtypes -- effects defined through creating a newtype
over an existing effect, and then defining actions and interpretations on
the newtype by using rewrite
and transform
.
By making a newtype of Bundle
, it's possible to wrap multiple effects in
one newtype.
Actions
sendBundle :: forall e r' r a. (Member e r', Member (Bundle r') r) => Sem (e ': r) a -> Sem r a Source #
Send uses of an effect to a Bundle
containing that effect.
Interpretations
runBundle :: forall r' r a. KnownList r' => Sem (Bundle r' ': r) a -> Sem (Append r' r) a Source #
Run a
by prepending Bundle
rr
to the effect stack.
subsumeBundle :: forall r' r a. Members r' r => Sem (Bundle r' ': r) a -> Sem r a Source #
Run a
if the effect stack contains all effects of Bundle
rr
.
Miscellaneous
class KnownList (l :: [k]) Source #
A class for type-level lists with a known spine.
This constraint is eventually satisfied as r
is instantied to a
concrete list.
Instances
KnownList ([] :: [k]) Source # | |
Defined in Polysemy.Internal.Bundle | |
KnownList r => KnownList (x ': r :: [k]) Source # | |
Defined in Polysemy.Internal.Bundle |