Safe Haskell | None |
---|---|
Language | Haskell2010 |
- type Faceted a as x b bs y = (MatchingFacet a x y, AsFacet b y)
- faceted :: forall w a as x b bs y. (Choice w, Faceted a as x b bs y) => w a b -> w x y
- facetedK :: forall m a as x b bs y. (Monad m, Faceted a as x b bs y) => (a -> m b) -> x -> m y
- type Injected a2 a3 b2 b3 = (Reinterpret a2 a3, ChooseBoth (Complement a3 a2) b2 b3, Complement a2 a3 ~ '[])
- injected :: forall w a2 a3 b2 b3. (Choice w, Injected a2 a3 b2 b3) => w (Which a2) (Which b2) -> w (Which a3) (Which b3)
- injectedK :: forall m a2 a3 b2 b3. (Monad m, Injected a2 a3 b2 b3) => (Which a2 -> m (Which b2)) -> Which a3 -> m (Which b3)
- type ChooseFrom a1 a2 a3 = (Reinterpret a2 a3, a1 ~ Complement a3 a2, a3 ~ Append a1 a2)
- type ChooseBoth b1 b2 b3 = (Diversify b1 b3, Diversify b2 b3, b3 ~ AppendUnique b1 b2)
- chooseBetween :: forall w a1 a2 a3 b1 b2 b3. (Category w, Choice w, ChooseFrom a1 a2 a3, ChooseBoth b1 b2 b3) => w (Which a1) (Which b1) -> w (Which a2) (Which b2) -> w (Which a3) (Which b3)
- chooseBetweenK :: forall m a1 a2 a3 b1 b2 b3. (Monad m, ChooseFrom a1 a2 a3, ChooseBoth b1 b2 b3) => (Which a1 -> m (Which b1)) -> (Which a2 -> m (Which b2)) -> Which a3 -> m (Which b3)
- thenChoose :: forall w a a2 b1 b2 b3. (Category w, Choice w, Injected a2 b1 b2 b3) => w a (Which b1) -> w (Which a2) (Which b2) -> w a (Which b3)
- thenChooseK :: forall m a a2 b1 b2 b3. (Monad m, Injected a2 b1 b2 b3) => (a -> m (Which b1)) -> (Which a2 -> m (Which b2)) -> a -> m (Which b3)
- also :: (Semigroup (f (Which a3)), Functor f, ChooseBoth a1 a2 a3) => f (Which a1) -> f (Which a2) -> f (Which a3)
- alternatively :: (Alternative f, ChooseBoth a1 a2 a3) => f (Which a1) -> f (Which a2) -> f (Which a3)
Combinators similar to Profunctor Choice
type Faceted a as x b bs y = (MatchingFacet a x y, AsFacet b y) Source #
A friendlier constraint synonym for faceted
.
faceted :: forall w a as x b bs y. (Choice w, Faceted a as x b bs y) => w a b -> w x y Source #
Like Choice
or ArrowChoice
but lifting into a polymorphic variant.
facetedK :: forall m a as x b bs y. (Monad m, Faceted a as x b bs y) => (a -> m b) -> x -> m y Source #
type Injected a2 a3 b2 b3 = (Reinterpret a2 a3, ChooseBoth (Complement a3 a2) b2 b3, Complement a2 a3 ~ '[]) Source #
A friendlier constraint synonym for injected
.
injected :: forall w a2 a3 b2 b3. (Choice w, Injected a2 a3 b2 b3) => w (Which a2) (Which b2) -> w (Which a3) (Which b3) Source #
Like Choice
or ArrowChoice
but lifting from Which
into another type of Which
NB. It is a compile error if all of the input types in the second arrow a
is not the output types of the first arrow.
This prevents surprising behaviour where the second arrow is completely ignored.
injectedK :: forall m a2 a3 b2 b3. (Monad m, Injected a2 a3 b2 b3) => (Which a2 -> m (Which b2)) -> Which a3 -> m (Which b3) Source #
type ChooseFrom a1 a2 a3 = (Reinterpret a2 a3, a1 ~ Complement a3 a2, a3 ~ Append a1 a2) Source #
A friendlier constraint synonym for chooseFrom
.
Redundant constraint: a3 ~ Append a1 a2
is redundant but narrows down a3
type ChooseBoth b1 b2 b3 = (Diversify b1 b3, Diversify b2 b3, b3 ~ AppendUnique b1 b2) Source #
A friendlier constraint synonym for chooseBoth
.
Redundant constraint: b3 ~ AppendUnique b1 b2
is redundant but narrows down b3
chooseBetween :: forall w a1 a2 a3 b1 b2 b3. (Category w, Choice w, ChooseFrom a1 a2 a3, ChooseBoth b1 b2 b3) => w (Which a1) (Which b1) -> w (Which a2) (Which b2) -> w (Which a3) (Which b3) infixr 2 Source #
Split the input between the two argument arrows, retagging and merging their outputs.
The output is merged into a Which
of unique types.
Analogous to a Which
combination of both +++
and |||
.
It is a compile error if the types are not distinct after Append
ing both argument arrows inputs.
This is to prevent accidently processing an input type twice.
The compile error will be due to (Append a1 a2)
which will not satisfy
UniqueMember
constraints in Reinterpret
.
chooseBetweenK :: forall m a1 a2 a3 b1 b2 b3. (Monad m, ChooseFrom a1 a2 a3, ChooseBoth b1 b2 b3) => (Which a1 -> m (Which b1)) -> (Which a2 -> m (Which b2)) -> Which a3 -> m (Which b3) infixr 2 Source #
chooseBetween
under Kleisli
thenChoose :: forall w a a2 b1 b2 b3. (Category w, Choice w, Injected a2 b1 b2 b3) => w a (Which b1) -> w (Which a2) (Which b2) -> w a (Which b3) infixr 2 Source #
Left-to-right chaining of arrows one after another, where left over possibilities not handled by the right arrow is forwarded to the output. It is a compile error if the types are not distinct in each of the argument arrow inputs, or if the types are not distinct in each of the argument arrow output. NB. It is currently not a compile error if the input of the second arrow is distinct from the output of the first arrrow, in which case this function does not change anything except to add the types of the second arrow to the output.
thenChooseK :: forall m a a2 b1 b2 b3. (Monad m, Injected a2 b1 b2 b3) => (a -> m (Which b1)) -> (Which a2 -> m (Which b2)) -> a -> m (Which b3) infixr 2 Source #
thenChoose
under Kleisli
also :: (Semigroup (f (Which a3)), Functor f, ChooseBoth a1 a2 a3) => f (Which a1) -> f (Which a2) -> f (Which a3) infixr 6 Source #
alternatively :: (Alternative f, ChooseBoth a1 a2 a3) => f (Which a1) -> f (Which a2) -> f (Which a3) infixl 3 Source #