| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Control.Effect.Union
Synopsis
- data Union (r :: [Effect]) m a where
- data ElemOf (e :: a) (r :: [a]) where
- unionize :: (Eff (Union b) m, KnownList b) => UnionizeC b m a -> m a
- unionizeHead :: (HeadEff (Union b) m, KnownList b) => UnionizeHeadC b m a -> m a
- runUnion :: forall b m a. (HeadEffs b m, KnownList b) => UnionC b m a -> m a
- inj :: Member e r => e m a -> Union r m a
- decomp :: RepresentationalEff e => Union (e ': r) m a -> Either (Union r m a) (e m a)
- extract :: RepresentationalEff e => Union '[e] m a -> e m a
- weaken :: Union r m a -> Union (e ': r) m a
- absurdU :: Union '[] m a -> b
- absurdMember :: ElemOf e '[] -> b
- membership :: Member e r => ElemOf e r
- data UnionizeC b m a
- type UnionizeHeadC b = CompositionC '[IntroC b '[Union b], UnionizeC b]
- data UnionC (l :: [Effect]) m a
Effects
data Union (r :: [Effect]) m a where Source #
An effect for collecting multiple effects into one effect.
Behind the scenes, Union is the most important effect
in the entire library, as the Carrier class is built
around handling Unions of effects.
However, even outside of defining novel Carrier instances,
Union can be useful as an effect in its own right.
Union is useful for effect newtypes -- effects defined through creating a
newtype over an existing effect.
By making a newtype of Union, it's possible to wrap multiple effects in one
newtype.
Not to be confused with Bundle.
Unlike Bundle, Union is a proper effect that is given no
special treatment by Eff or Effs.
Actions
unionizeHead :: (HeadEff (Union b) m, KnownList b) => UnionizeHeadC b m a -> m a Source #
Interpretations
Utilities
inj :: Member e r => e m a -> Union r m a Source #
Inject an effect into a Union containing that effect.
extract :: RepresentationalEff e => Union '[e] m a -> e m a Source #
Extract the only effect of an Union.
absurdMember :: ElemOf e '[] -> b Source #
membership :: Member e r => ElemOf e r Source #
Carriers
Instances
type UnionizeHeadC b = CompositionC '[IntroC b '[Union b], UnionizeC b] Source #
data UnionC (l :: [Effect]) m a Source #