License | MIT |
---|---|
Maintainer | dan.firth@homotopic.tech |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
Functions for combining polysemy-methodology with composite.
Synopsis
- runMethodologyRmap :: forall f g xs r a. RMap xs => (forall y. f y -> g y) -> Sem (Methodology (Rec f xs) (Rec g xs) ': r) a -> Sem r a
- runCoRecMethodologyAsCases :: forall f zs c x xs r a. (zs ~ (x ': xs), RecApplicative zs, Members '[Input (Cases' f zs c)] r) => Sem (Methodology (CoRec f zs) c ': r) a -> Sem r a
- runCoRecMethodologyAsCases' :: forall f zs c x xs r a. (zs ~ (x ': xs), RecApplicative zs) => Sem (Methodology (CoRec f zs) c ': r) a -> Sem (Input (Cases' f zs c) ': r) a
- diffractMethodology :: forall b f zs d x xs r a. (Monoid d, zs ~ (x ': xs), RecApplicative zs, Members '[Methodology b [CoRec f zs], Input (Cases' f zs d)] r) => Sem (Methodology b d ': r) a -> Sem r a
- diffractMethodology' :: forall b f zs d x xs r a. (Monoid d, zs ~ (x ': xs), RecApplicative zs) => Sem (Methodology b d ': r) a -> Sem (Methodology b [CoRec f zs] ': (Input (Cases' f zs d) ': r)) a
- runInputCase' :: forall b f t r a. (f b -> t) -> Sem (Input (Case' f t b) ': r) a -> Sem r a
- pickCoRecConstructor :: forall x f b xs r a. x ∈ xs => Sem (Methodology b (CoRec f xs) ': r) a -> Sem (Methodology b (f x) ': r) a
- separateRecInitial :: forall b f x xs r a. Members '[Methodology b (f x), Methodology b (Rec f xs)] r => Sem (Methodology b (Rec f (x ': xs)) ': r) a -> Sem r a
- separateRecInitial' :: forall b f x xs r a. Sem (Methodology b (Rec f (x ': xs)) ': r) a -> Sem (Methodology b (f x) ': (Methodology b (Rec f xs) ': r)) a
- stripRecInitial :: forall b f x xs r a. Members '[Methodology b (f x)] (Methodology b (Rec f xs) ': r) => Sem (Methodology b (Rec f (x ': xs)) ': r) a -> Sem (Methodology b (Rec f xs) ': r) a
- endRecInitial :: Sem (Methodology b (Rec f '[]) ': r) a -> Sem r a
- runRecInitialAsInputCompose :: forall b f xs r a. (RMap xs, Members '[Input (Rec (Compose ((->) b) f) xs)] r) => Sem (Methodology b (Rec f xs) ': r) a -> Sem r a
- runRecInitialAsInputCompose' :: forall b f xs r a. RMap xs => Sem (Methodology b (Rec f xs) ': r) a -> Sem (Input (Rec (Compose ((->) b) f) xs) ': r) a
- separateRecTerminal :: forall x c f xs r a. (Monoid c, Members '[Methodology (f x) c, Methodology (Rec f xs) c] r) => Sem (Methodology (Rec f (x ': xs)) c ': r) a -> Sem r a
- separateRecTerminal' :: forall x c f xs r a. Monoid c => Sem (Methodology (Rec f (x ': xs)) c ': r) a -> Sem (Methodology (f x) c ': (Methodology (Rec f xs) c ': r)) a
- stripRecTerminal :: forall x c f xs r a. (Monoid c, Members '[Methodology (f x) c] (Methodology (Rec f xs) c ': r)) => Sem (Methodology (Rec f (x ': xs)) c ': r) a -> Sem (Methodology (Rec f xs) c ': r) a
- endRecTerminal :: Monoid b => Sem (Methodology (Rec f '[]) b ': r) a -> Sem r a
- fmapCMethodology :: forall f g h b c r a. Traversable f => Sem (Methodology ((f :. g) b) ((f :. h) c) ': r) a -> Sem (Methodology (g b) (h c) ': r) a
- fmapCMethodology' :: forall f g h b c r a. Traversable f => Sem (Methodology ((f :. g) b) ((f :. h) c) ': r) a -> Sem (Methodology (g b) (h c) ': r) a
Documentation
runMethodologyRmap :: forall f g xs r a. RMap xs => (forall y. f y -> g y) -> Sem (Methodology (Rec f xs) (Rec g xs) ': r) a -> Sem r a Source #
Run a Methodology
between two Rec
s according to a natural transformation
between the interpretation functors.
Since: 0.1.4.0
runCoRecMethodologyAsCases Source #
:: forall f zs c x xs r a. (zs ~ (x ': xs), RecApplicative zs, Members '[Input (Cases' f zs c)] r) | |
=> Sem (Methodology (CoRec f zs) c ': r) a | The Methodology to decompose. |
-> Sem r a |
Run a Methodology
from a CoRec
to an Input
of Cases
`. You can then use separateRecInput
and stripRecInput
to deal with the cases individually.
Since: 0.1.0.0
runCoRecMethodologyAsCases' Source #
:: forall f zs c x xs r a. (zs ~ (x ': xs), RecApplicative zs) | |
=> Sem (Methodology (CoRec f zs) c ': r) a | The Methodology to decompose. |
-> Sem (Input (Cases' f zs c) ': r) a |
Reinterpreting version of runCoRecMethodologyAsCases
.
Since: 0.1.0.0
:: forall b f zs d x xs r a. (Monoid d, zs ~ (x ': xs), RecApplicative zs, Members '[Methodology b [CoRec f zs], Input (Cases' f zs d)] r) | |
=> Sem (Methodology b d ': r) a | The Methodology to decompose. |
-> Sem r a |
Diffraction is a combination of a cutMethodology
`, an mconcatMethodology
` and a runCoRecMethodologyAsCases
.
This effectively allows you to make several ad-hoc constructors for d and fully consumes the second half of the cut. This turns out to be quite a good way to start a simple pipeline.
Since: 0.1.0.0
:: forall b f zs d x xs r a. (Monoid d, zs ~ (x ': xs), RecApplicative zs) | |
=> Sem (Methodology b d ': r) a | The Methodology to decompose. |
-> Sem (Methodology b [CoRec f zs] ': (Input (Cases' f zs d) ': r)) a |
Reinterpreting version of diffractMethodology
.
Since: 0.1.0.0
runInputCase' :: forall b f t r a. (f b -> t) -> Sem (Input (Case' f t b) ': r) a -> Sem r a Source #
Run a Case
` using runInputConst
and a function eliminating the Case
`.
Since: 0.1.1.0
pickCoRecConstructor :: forall x f b xs r a. x ∈ xs => Sem (Methodology b (CoRec f xs) ': r) a -> Sem (Methodology b (f x) ': r) a Source #
Take a Methodology
into a CoRec
and choose a constructor.
Since: 0.1.4.0
:: forall b f x xs r a. Members '[Methodology b (f x), Methodology b (Rec f xs)] r | |
=> Sem (Methodology b (Rec f (x ': xs)) ': r) a | The Methodology to decompose. |
-> Sem r a |
Factor a Methodology
with a Rec
in the result by a Methodology
to the first variable.
Since: 0.1.3.0
separateRecInitial' :: forall b f x xs r a. Sem (Methodology b (Rec f (x ': xs)) ': r) a -> Sem (Methodology b (f x) ': (Methodology b (Rec f xs) ': r)) a Source #
Reinterpreting version of separateRecInitial
. This assumes you want to handle
the separated case first.
Since: 0.1.3.0
stripRecInitial :: forall b f x xs r a. Members '[Methodology b (f x)] (Methodology b (Rec f xs) ': r) => Sem (Methodology b (Rec f (x ': xs)) ': r) a -> Sem (Methodology b (Rec f xs) ': r) a Source #
Like separateRecInitial
, but reinterprets the rest of the Rec
whilst pushing
the separated Methodology
into the stack. Useful for exhausting the Rec
and
dealing with the cases later.
Since: 0.1.3.0
endRecInitial :: Sem (Methodology b (Rec f '[]) ': r) a -> Sem r a Source #
Discard a depleted Methodology
into a Rec
by returning RNil
.
Since: 0.1.3.0
runRecInitialAsInputCompose :: forall b f xs r a. (RMap xs, Members '[Input (Rec (Compose ((->) b) f) xs)] r) => Sem (Methodology b (Rec f xs) ': r) a -> Sem r a Source #
Run a Methodology
into a Rec
as an Input
over a (->)
functor.
Since: 0.1.3.0
runRecInitialAsInputCompose' :: forall b f xs r a. RMap xs => Sem (Methodology b (Rec f xs) ': r) a -> Sem (Input (Rec (Compose ((->) b) f) xs) ': r) a Source #
Reinterpreting version of runRecInitialAsInputCompose
.
Since: 0.1.3.0
separateRecTerminal :: forall x c f xs r a. (Monoid c, Members '[Methodology (f x) c, Methodology (Rec f xs) c] r) => Sem (Methodology (Rec f (x ': xs)) c ': r) a -> Sem r a Source #
Factor a Methodology
from a Rec
by a Methodology
from the first variable.
since @0.1.3.0
separateRecTerminal' :: forall x c f xs r a. Monoid c => Sem (Methodology (Rec f (x ': xs)) c ': r) a -> Sem (Methodology (f x) c ': (Methodology (Rec f xs) c ': r)) a Source #
Reinterpreted version of separateRecTerminal
.
since @0.1.3.0
stripRecTerminal :: forall x c f xs r a. (Monoid c, Members '[Methodology (f x) c] (Methodology (Rec f xs) c ': r)) => Sem (Methodology (Rec f (x ': xs)) c ': r) a -> Sem (Methodology (Rec f xs) c ': r) a Source #
Like `separateRecTerminal, but reinterprets the rest of the Rec
whilst pushing
the separated Methodology
into the stack. Useful for exhausting the Rec
and
dealing with the cases later.
since @0.1.3.0
endRecTerminal :: Monoid b => Sem (Methodology (Rec f '[]) b ': r) a -> Sem r a Source #
Discard a depleted Methodology
fom a Rec
by returning mempty
.
Since: 0.1.3.0
fmapCMethodology :: forall f g h b c r a. Traversable f => Sem (Methodology ((f :. g) b) ((f :. h) c) ': r) a -> Sem (Methodology (g b) (h c) ': r) a Source #
Like fmapMethodology
, but used with a Compose
d functor to strip the top
layer from the functor.
Since: 0.1.4.0
fmapCMethodology' :: forall f g h b c r a. Traversable f => Sem (Methodology ((f :. g) b) ((f :. h) c) ': r) a -> Sem (Methodology (g b) (h c) ': r) a Source #
Reinterpreting version of fmapCMethodology
.
Since: 0.1.4.0