Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- newtype ComposeT t (u :: (* -> *) -> * -> *) m a = ComposeT {
- getComposeT :: t (u m) a
- newtype CompositionC ts m a = CompositionC {
- unCompositionC :: CompositionBaseT ts m a
- type family CompositionBaseT' acc ts :: (* -> *) -> * -> * where ...
- type CompositionBaseT ts = CompositionBaseT' IdentityT ts
- type family CompositionBaseM (ts :: [(* -> *) -> * -> *]) (m :: * -> *) where ...
- runComposition :: CompositionC ts m a -> CompositionBaseM ts m a
Documentation
newtype ComposeT t (u :: (* -> *) -> * -> *) m a Source #
Composition of monad/carrier transformers.
ComposeT | |
|
Instances
newtype CompositionC ts m a Source #
Composition of a list of carrier transformers.
This is useful when you have multiple interpretations whose
carriers you'd like to treat as one larger object, such that
lift
lifts past all those carriers.
For example:
data Counter m a where Probe :: Counter m Int type CounterC =CompositionC
'[ReinterpretSimpleC
Counter '[State
Int] ,StateC
Int ] runCounter :: (Carrier
m,Threaders
'[StateThreads
] m p) => CounterC m a -> m a runCounter =runState
0 .reinterpretSimple
(case Probe ->state'
(s -> (s+1,s)) ) .runComposition
Then you have lift
:: Monad m => m a -> CounterC m a
CompositionC | |
|
Instances
type family CompositionBaseT' acc ts :: (* -> *) -> * -> * where ... Source #
CompositionBaseT' acc '[] = acc | |
CompositionBaseT' acc (t ': ts) = CompositionBaseT' (ComposeT acc t) ts |
type CompositionBaseT ts = CompositionBaseT' IdentityT ts Source #
type family CompositionBaseM (ts :: [(* -> *) -> * -> *]) (m :: * -> *) where ... Source #
CompositionBaseM '[] m = m | |
CompositionBaseM (t ': ts) m = t (CompositionBaseM ts m) |
runComposition :: CompositionC ts m a -> CompositionBaseM ts m a Source #
Transform
to CompositionC
[t1, t2, ..., tn] m at1 (t2 (... (tn m) ...)) a