Safe Haskell  None 

Language  Haskell2010 
Synopsis
 data Union (r :: EffectRow) (m :: Type > Type) a where
 data Weaving e m a where
 type Member e r = MemberNoError e r
 type MemberWithError e r = (MemberNoError e r, WhenStuck (IndexOf r (Found r e)) (AmbiguousSend r e))
 weave :: (Functor s, Functor m, Functor n) => s () > (forall x. s (m x) > n (s x)) > (forall x. s x > Maybe x) > Union r m a > Union r n (s a)
 hoist :: (Functor m, Functor n) => (forall x. m x > n x) > Union r m a > Union r n a
 inj :: forall e r m a. (Functor m, Member e r) => e m a > Union r m a
 injWeaving :: forall e r m a. Member e r => Weaving e m a > Union r m a
 weaken :: forall e r m a. Union r m a > Union (e ': r) m a
 decomp :: Union (e ': r) m a > Either (Union r m a) (Weaving e m a)
 prj :: forall e r m a. Member e r => Union r m a > Maybe (Weaving e m a)
 extract :: Union '[e] m a > Weaving e m a
 absurdU :: Union '[] m a > b
 decompCoerce :: Union (e ': r) m a > Either (Union (f ': r) m a) (Weaving e m a)
 data SNat :: Nat > Type where
 data Nat
Documentation
data Union (r :: EffectRow) (m :: Type > Type) a where Source #
An extensible, typesafe union. The r
type parameter is a typelevel
list of effects, any one of which may be held within the Union
.
data Weaving e m a where Source #
Weaving  

type Member e r = MemberNoError e r Source #
A proof that the effect e
is available somewhere inside of the effect
stack r
.
type MemberWithError e r = (MemberNoError e r, WhenStuck (IndexOf r (Found r e)) (AmbiguousSend r e)) Source #
weave :: (Functor s, Functor m, Functor n) => s () > (forall x. s (m x) > n (s x)) > (forall x. s x > Maybe x) > Union r m a > Union r n (s a) Source #
Building Unions
inj :: forall e r m a. (Functor m, Member e r) => e m a > Union r m a Source #
Lift an effect e
into a Union
capable of holding it.
weaken :: forall e r m a. Union r m a > Union (e ': r) m a Source #
Weaken a Union
so it is capable of storing a new sort of effect.
Using Unions
decomp :: Union (e ': r) m a > Either (Union r m a) (Weaving e m a) Source #
Decompose a Union
. Either this union contains an effect e
the head
of the r
listor it doesn't.
prj :: forall e r m a. Member e r => Union r m a > Maybe (Weaving e m a) Source #
Attempt to take an e
effect out of a Union
.
absurdU :: Union '[] m a > b Source #
An empty union contains nothing, so this function is uncallable.
decompCoerce :: Union (e ': r) m a > Either (Union (f ': r) m a) (Weaving e m a) Source #
Like decomp
, but allows for a more efficient
reinterpret
function.