polysemy-1.3.0.0: Higher-order, low-boilerplate, zero-cost free monads.

Safe HaskellNone
LanguageHaskell2010

Polysemy.Bundle

Contents

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

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.

Minimal complete definition

unconsKnownList

Instances
KnownList ([] :: [k]) Source # 
Instance details

Defined in Polysemy.Internal.Bundle

Methods

unconsKnownList :: (([] ~ []) -> a) -> (forall (x :: k0) (r :: [k0]). ([] ~ (x ': r), KnownList r) => Proxy x -> Proxy r -> a) -> a Source #

KnownList r => KnownList (x ': r :: [k]) Source # 
Instance details

Defined in Polysemy.Internal.Bundle

Methods

unconsKnownList :: (((x ': r) ~ []) -> a) -> (forall (x0 :: k0) (r0 :: [k0]). ((x ': r) ~ (x0 ': r0), KnownList r0) => Proxy x0 -> Proxy r0 -> a) -> a Source #