data-diverse-lens-2.1.0.0: Isos & Lens for Data.Diverse.Many and Prisms for Data.Diverse.Which

Safe HaskellNone
LanguageHaskell2010

Data.Diverse.Profunctor.Which

Contents

Synopsis

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. (Profunctor w, 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.

faceted' :: (Profunctor w, Choice w) => w a b -> w (Which '[a]) (Which '[b]) Source #

Like Choice or ArrowChoice but lifting into Which of one type

type Injected a a' b b' = (Reinterpret a a', Diversify b (AppendUnique (Complement a' a) b), Diversify (Complement a' a) (AppendUnique (Complement a' a) b), b' ~ AppendUnique (Complement a' a) b, Complement a a' ~ '[]) Source #

A friendlier constraint synonym for injected.

injected :: (Profunctor w, Choice w, Injected a a' b b') => w (Which a) (Which b) -> w (Which a') (Which b') 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 ignored.

type ChooseBetween a1 a2 a3 b1 b2 b3 = (Reinterpret a2 (Append a1 a2), a1 ~ Complement (Append a1 a2) a2, a3 ~ Append a1 a2, Diversify b1 (AppendUnique b1 b2), Diversify b2 (AppendUnique b1 b2), b3 ~ AppendUnique b1 b2) Source #

A friendlier constraint synonym for +||+.

(+||+) :: forall w a1 a2 a3 b1 b2 b3. (Category w, Profunctor w, Choice w, ChooseBetween a1 a2 a3 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 Appending 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.

(>||>) :: 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 of each of the argument arrow output, or if the input of the second arrow is not a subset of the output of the first arrow. This is to prevent surprises behaviour of the second arrow being ignored. The compile error will be due to the Complement c b ~ '[] constraint.

(<||<) :: forall w a a2 b1 b2 b3. (Category w, Choice w, Injected a2 b1 b2 b3) => w (Which a2) (Which b2) -> w a (Which b1) -> w a (Which b3) infixl 2 Source #

right-to-left version of '(>||>)'