polysemy-1.6.0.0: Higher-order, low-boilerplate free monads.
Safe HaskellNone
LanguageHaskell2010

Polysemy.Bundle

Synopsis

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.

Constructors

Bundle :: ElemOf e r -> e m a -> Bundle r m a 

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.

injBundle :: forall e r m a. Member e r => e m a -> Bundle r m a Source #

Injects an effect into a Bundle. Useful together with transform.

Interpretations

runBundle :: forall r' r a. KnownList r' => Sem (Bundle r' ': r) a -> Sem (Append r' r) a Source #

Run a Bundle r by prepending r to the effect stack.

subsumeBundle :: forall r' r a. Members r' r => Sem (Bundle r' ': r) a -> Sem r a Source #

Run a Bundle r if the effect stack contains all effects of r.

Miscellaneous