proarrow
Safe HaskellNone
LanguageGHC2024

Proarrow.Optic.Traversal

Description

The traversal: the many-focus optic, distributing any StrongDistributiveProfunctor with product strength through the foci. This module keeps the mutually-recursive TravFl/MonTravFl flavor classes and their leaf witnesses (Traversable and Cotraversable functors, the product lens, the coproduct prism, Beside/BesideSum juxtaposition and the unit/zero witnesses). The free-profunctor apparatus lives in Proarrow.Optic.MonoidalTraversal. A traversal subtypes to Fold and Setter. Build with traversed (from a Traversable), fromTravVL (from a Prelude traversal) or traversal (from the profunctor-class form), eliminate with traverseOf.

Synopsis

Documentation

class (SetterFl p q, FoldFl p q) => TravFl (p :: k +-> k) (q :: k +-> k) where Source Github #

Minimal complete definition

Nothing

Methods

travP :: forall r (s :: k) (a :: k) (b :: k) (t :: k). (StrongDistributiveProfunctor r, Strong (ProdAction :: k -> (PROD k, k) -> Type) r) => p s a -> q b t -> r a b -> r s t Source Github #

Distribute a traversal-strength profunctor. Only the product-lens witness needs Strong ProdAction (to carry the residual through the categorical product). Every other witness distributes a plain StrongDistributiveProfunctor and inherits travP from monTravP.

default travP :: forall r (s :: k) (a :: k) (b :: k) (t :: k). (MonTravFl p q, StrongDistributiveProfunctor r) => p s a -> q b t -> r a b -> r s t Source Github #

Instances

Instances details
(Distributive k, CopyDiscard k, Traversable t, Representable t) => TravFl (t :: k +-> k) (RepCostar t :: k -> k -> Type) Source Github # 
Instance details

Defined in Proarrow.Optic.Traversal

Methods

travP :: forall r (s :: k) (a :: k) (b :: k) (t0 :: k). (StrongDistributiveProfunctor r, Strong (ProdAction :: k -> (PROD k, k) -> Type) r) => t s a -> RepCostar t b t0 -> r a b -> r s t0 Source Github #

Monoidal k => TravFl (UnitW :: k -> k -> Type) (CoUnitW :: k -> k -> Type) Source Github # 
Instance details

Defined in Proarrow.Optic.Traversal

Methods

travP :: forall r (s :: k) (a :: k) (b :: k) (t :: k). (StrongDistributiveProfunctor r, Strong (ProdAction :: k -> (PROD k, k) -> Type) r) => UnitW s a -> CoUnitW b t -> r a b -> r s t Source Github #

HasInitialObject k => TravFl (ZeroW :: k -> k -> Type) (CoZeroW :: k -> k -> Type) Source Github # 
Instance details

Defined in Proarrow.Optic.Traversal

Methods

travP :: forall r (s :: k) (a :: k) (b :: k) (t :: k). (StrongDistributiveProfunctor r, Strong (ProdAction :: k -> (PROD k, k) -> Type) r) => ZeroW s a -> CoZeroW b t -> r a b -> r s t Source Github #

CategoryOf k => TravFl (Id :: k -> k -> Type) (Id :: k -> k -> Type) Source Github # 
Instance details

Defined in Proarrow.Optic.Traversal

Methods

travP :: forall r (s :: k) (a :: k) (b :: k) (t :: k). (StrongDistributiveProfunctor r, Strong (ProdAction :: k -> (PROD k, k) -> Type) r) => Id s a -> Id b t -> r a b -> r s t Source Github #

(Monoidal k, SNatI n) => TravFl (Pow n :: k -> k -> Type) (CoPow n :: k -> k -> Type) Source Github # 
Instance details

Defined in Proarrow.Optic.PowerGrate

Methods

travP :: forall r (s :: k) (a :: k) (b :: k) (t :: k). (StrongDistributiveProfunctor r, Strong (ProdAction :: k -> (PROD k, k) -> Type) r) => Pow n s a -> CoPow n b t -> r a b -> r s t Source Github #

(Distributive k, CopyDiscard k, Cotraversable t, Corepresentable t) => TravFl (CorepStar t :: k -> k -> Type) (t :: k +-> k) Source Github #

A corepresentable Cotraversable functor builds s from a shape of a's, and its travP distributes an SDP the same way a cotraversal's would. So at this witness a cotraversal is a traversal, and it needs no flavor of its own. (Proarrow.Optic.Kaleidoscope does define a Cotraversal, over Cotraversable witnesses that are not representable. In the lattice it is a sibling of Traversal, not a descendant: both are children of Setter, and Cotraversal's own child is Kaleidoscope.)

Instance details

Defined in Proarrow.Optic.Traversal

Methods

travP :: forall r (s :: k) (a :: k) (b :: k) (t0 :: k). (StrongDistributiveProfunctor r, Strong (ProdAction :: k -> (PROD k, k) -> Type) r) => CorepStar t s a -> t b t0 -> r a b -> r s t0 Source Github #

(TravFl p1 q1, TravFl p2 q2, Monoidal k) => TravFl (Beside p1 p2 :: k -> k -> Type) (CoBeside q1 q2 :: k -> k -> Type) Source Github # 
Instance details

Defined in Proarrow.Optic.Traversal

Methods

travP :: forall r (s :: k) (a :: k) (b :: k) (t :: k). (StrongDistributiveProfunctor r, Strong (ProdAction :: k -> (PROD k, k) -> Type) r) => Beside p1 p2 s a -> CoBeside q1 q2 b t -> r a b -> r s t Source Github #

(TravFl p1 q1, TravFl p2 q2, HasBinaryCoproducts k) => TravFl (BesideSum p1 p2 :: k -> k -> Type) (CoBesideSum q1 q2 :: k -> k -> Type) Source Github # 
Instance details

Defined in Proarrow.Optic.Traversal

Methods

travP :: forall r (s :: k) (a :: k) (b :: k) (t :: k). (StrongDistributiveProfunctor r, Strong (ProdAction :: k -> (PROD k, k) -> Type) r) => BesideSum p1 p2 s a -> CoBesideSum q1 q2 b t -> r a b -> r s t Source Github #

Comonoid m => TravFl (Rep (ActionAt (Tensor :: k -> (k, k) -> Type) m) :: k -> k -> Type) (Corep (ActionAt (Tensor :: k -> (k, k) -> Type) m) :: k -> k -> Type) Source Github # 
Instance details

Defined in Proarrow.Optic.Traversal

Methods

travP :: forall r (s :: k) (a :: k) (b :: k) (t :: k). (StrongDistributiveProfunctor r, Strong (ProdAction :: k -> (PROD k, k) -> Type) r) => Rep (ActionAt (Tensor :: k -> (k, k) -> Type) m) s a -> Corep (ActionAt (Tensor :: k -> (k, k) -> Type) m) b t -> r a b -> r s t Source Github #

(CopyDiscard k, HasCoproducts k, Ob t) => TravFl (Rep (Coproduct t) :: k -> k -> Type) (Corep (Coproduct t) :: k -> k -> Type) Source Github # 
Instance details

Defined in Proarrow.Optic.Traversal

Methods

travP :: forall r (s :: k) (a :: k) (b :: k) (t0 :: k). (StrongDistributiveProfunctor r, Strong (ProdAction :: k -> (PROD k, k) -> Type) r) => Rep (Coproduct t) s a -> Corep (Coproduct t) b t0 -> r a b -> r s t0 Source Github #

(HasBinaryProducts k, Ob s) => TravFl (Rep (Product s) :: k -> k -> Type) (Corep (Product s) :: k -> k -> Type) Source Github # 
Instance details

Defined in Proarrow.Optic.Traversal

Methods

travP :: forall r (s0 :: k) (a :: k) (b :: k) (t :: k). (StrongDistributiveProfunctor r, Strong (ProdAction :: k -> (PROD k, k) -> Type) r) => Rep (Product s) s0 a -> Corep (Product s) b t -> r a b -> r s0 t Source Github #

(TravFl f g, TravFl f' g') => TravFl (f :.: f' :: i -> i -> Type) (g' :.: g :: i -> i -> Type) Source Github # 
Instance details

Defined in Proarrow.Optic.Traversal

Methods

travP :: forall r (s :: i) (a :: i) (b :: i) (t :: i). (StrongDistributiveProfunctor r, Strong (ProdAction :: i -> (PROD i, i) -> Type) r) => (f :.: f') s a -> (g' :.: g) b t -> r a b -> r s t Source Github #

class TravFl p q => MonTravFl (p :: k +-> k) (q :: k +-> k) where Source Github #

A monoidal traversal sits between PowerGrate and Traversal: it distributes any StrongDistributiveProfunctor without the product-strength a lens-as-traversal needs. Every traversal witness except the product lens is a monoidal traversal.

Methods

monTravP :: forall r (s :: k) (a :: k) (b :: k) (t :: k). StrongDistributiveProfunctor r => p s a -> q b t -> r a b -> r s t Source Github #

Instances

Instances details
(Distributive k, CopyDiscard k, Traversable t, Representable t) => MonTravFl (t :: k +-> k) (RepCostar t :: k -> k -> Type) Source Github # 
Instance details

Defined in Proarrow.Optic.Traversal

Methods

monTravP :: forall r (s :: k) (a :: k) (b :: k) (t0 :: k). StrongDistributiveProfunctor r => t s a -> RepCostar t b t0 -> r a b -> r s t0 Source Github #

Monoidal k => MonTravFl (UnitW :: k -> k -> Type) (CoUnitW :: k -> k -> Type) Source Github # 
Instance details

Defined in Proarrow.Optic.Traversal

Methods

monTravP :: forall r (s :: k) (a :: k) (b :: k) (t :: k). StrongDistributiveProfunctor r => UnitW s a -> CoUnitW b t -> r a b -> r s t Source Github #

HasInitialObject k => MonTravFl (ZeroW :: k -> k -> Type) (CoZeroW :: k -> k -> Type) Source Github # 
Instance details

Defined in Proarrow.Optic.Traversal

Methods

monTravP :: forall r (s :: k) (a :: k) (b :: k) (t :: k). StrongDistributiveProfunctor r => ZeroW s a -> CoZeroW b t -> r a b -> r s t Source Github #

CategoryOf k => MonTravFl (Id :: k -> k -> Type) (Id :: k -> k -> Type) Source Github # 
Instance details

Defined in Proarrow.Optic.Traversal

Methods

monTravP :: forall r (s :: k) (a :: k) (b :: k) (t :: k). StrongDistributiveProfunctor r => Id s a -> Id b t -> r a b -> r s t Source Github #

(Monoidal k, SNatI n) => MonTravFl (Pow n :: k -> k -> Type) (CoPow n :: k -> k -> Type) Source Github # 
Instance details

Defined in Proarrow.Optic.PowerGrate

Methods

monTravP :: forall r (s :: k) (a :: k) (b :: k) (t :: k). StrongDistributiveProfunctor r => Pow n s a -> CoPow n b t -> r a b -> r s t Source Github #

(Distributive k, CopyDiscard k, Cotraversable t, Corepresentable t) => MonTravFl (CorepStar t :: k -> k -> Type) (t :: k +-> k) Source Github # 
Instance details

Defined in Proarrow.Optic.Traversal

Methods

monTravP :: forall r (s :: k) (a :: k) (b :: k) (t0 :: k). StrongDistributiveProfunctor r => CorepStar t s a -> t b t0 -> r a b -> r s t0 Source Github #

(MonTravFl p1 q1, MonTravFl p2 q2, Monoidal k) => MonTravFl (Beside p1 p2 :: k -> k -> Type) (CoBeside q1 q2 :: k -> k -> Type) Source Github # 
Instance details

Defined in Proarrow.Optic.Traversal

Methods

monTravP :: forall r (s :: k) (a :: k) (b :: k) (t :: k). StrongDistributiveProfunctor r => Beside p1 p2 s a -> CoBeside q1 q2 b t -> r a b -> r s t Source Github #

(MonTravFl p1 q1, MonTravFl p2 q2, HasBinaryCoproducts k) => MonTravFl (BesideSum p1 p2 :: k -> k -> Type) (CoBesideSum q1 q2 :: k -> k -> Type) Source Github # 
Instance details

Defined in Proarrow.Optic.Traversal

Methods

monTravP :: forall r (s :: k) (a :: k) (b :: k) (t :: k). StrongDistributiveProfunctor r => BesideSum p1 p2 s a -> CoBesideSum q1 q2 b t -> r a b -> r s t Source Github #

Comonoid m => MonTravFl (Rep (ActionAt (Tensor :: k -> (k, k) -> Type) m) :: k -> k -> Type) (Corep (ActionAt (Tensor :: k -> (k, k) -> Type) m) :: k -> k -> Type) Source Github # 
Instance details

Defined in Proarrow.Optic.Traversal

Methods

monTravP :: forall r (s :: k) (a :: k) (b :: k) (t :: k). StrongDistributiveProfunctor r => Rep (ActionAt (Tensor :: k -> (k, k) -> Type) m) s a -> Corep (ActionAt (Tensor :: k -> (k, k) -> Type) m) b t -> r a b -> r s t Source Github #

(CopyDiscard k, HasCoproducts k, Ob t) => MonTravFl (Rep (Coproduct t) :: k -> k -> Type) (Corep (Coproduct t) :: k -> k -> Type) Source Github # 
Instance details

Defined in Proarrow.Optic.Traversal

Methods

monTravP :: forall r (s :: k) (a :: k) (b :: k) (t0 :: k). StrongDistributiveProfunctor r => Rep (Coproduct t) s a -> Corep (Coproduct t) b t0 -> r a b -> r s t0 Source Github #

(MonTravFl f g, MonTravFl f' g') => MonTravFl (f :.: f' :: i -> i -> Type) (g' :.: g :: i -> i -> Type) Source Github # 
Instance details

Defined in Proarrow.Optic.Traversal

Methods

monTravP :: forall r (s :: i) (a :: i) (b :: i) (t :: i). StrongDistributiveProfunctor r => (f :.: f') s a -> (g' :.: g) b t -> r a b -> r s t Source Github #

type Traversal (s :: k) (t :: k) (a :: k) (b :: k) = Optic (Prostrong (TravFl :: (k +-> k) -> (k +-> k) -> Constraint)) s t a b Source Github #

type Traversal' (s :: k) (a :: k) = Traversal s s a a Source Github #

traverseOf :: forall {k} (c :: (k -> k -> Type) -> Constraint) (s :: k) (t :: k) (a :: k) (b :: k) p. (Distributive k, StrongDistributiveProfunctor p, Strong (ProdAction :: k -> (PROD k, k) -> Type) p, (Ob a, Ob b) => c (ExOptic (TravFl :: (k +-> k) -> (k +-> k) -> Constraint) a b)) => Optic c s t a b -> p a b -> p s t Source Github #

Distribute any StrongDistributiveProfunctor (not only a Star f, the van-Laarhoven shape) through any optic that is at least a Traversal, by handing it to travP.

The optic may be in any encoding: the constraint asks its class to hold for the generic carrier ExOptic TravFl a b. A Prostrong-flavored optic discharges it via forall p q. w p q => Sub TravFl p q, a (%)-composite one conjunct at a time, and a profunctor-class one (PTraversalFull) through the carrier's by-generator instances.

traversed :: forall {k} (t :: k +-> k) (a :: k) (b :: k). (Distributive k, CopyDiscard k, Traversable t, Representable t, Ob a, Ob b) => Traversal (t % a) (t % b) a b Source Github #

Build a traversal from a Traversable (representable) functor t: it focuses every element the functor holds. This is the one weak-flavor builder that is primitive: a Traversables traversal is not reachable by convert from any single stronger optic. The witness is t itself paired with RepCostar t (see TravFl above). The two legs are the representable universal repUniv and the identity RepCostar.

The free traversal profunctor

type Beside (p1 :: k +-> k) (p2 :: k +-> k) = (Rep (MultRep :: k -> (k, k) -> Type) :.: (p1 :**: p2)) :.: Rep (Diag :: k +-> (k, k)) Source Github #

Witness pair for traversing two juxtaposed (tensored) parts in sequence, both focusing x:

Beside p1 p2 s x = exists s1 s2. (s ~> s1 ** s2, p1 s1 x, p2 s2 x)

spelled as a composite through (k, k): split the source with the tensor (Rep MultRep), run the witnesses side by side (:**:), and identify the foci with the diagonal (Rep Diag). Day is the same composite with Corep MultRep in place of the diagonal, tensoring the foci instead. Identifying them is necessary: a Day witness pair admits no componentwise travP, which would have to split a StrongDistributiveProfunctor value at a tensor. So DayFl optics focus pairs, while this one visits both foci in turn.

type CoBeside (q1 :: k +-> k) (q2 :: k +-> k) = (Corep (Diag :: k +-> (k, k)) :.: (q1 :**: q2)) :.: Corep (MultRep :: k -> (k, k) -> Type) Source Github #

The covariant half of the Beside witness pair: duplicate the focus with the diagonal (Corep Diag), run the two witnesses side by side, recompose the targets with the tensor (Corep MultRep, t1 ** t2 ~> t).

type BesideSum (p1 :: k +-> k) (p2 :: k +-> k) = (Rep (PlusRep :: k -> (k, k) -> Type) :.: (p1 :**: p2)) :.: Rep (Diag :: k +-> (k, k)) Source Github #

Witness pair for traversing one of two alternative (coproduct) parts: Beside with the tensor replaced by the coproduct (Rep PlusRep, s ~> s1 || s2, and Corep PlusRep, t1 || t2 ~> t). Here identifying the foci and tensoring them agree, since x1 || x2 ~> x is a pair (x1 ~> x, x2 ~> x). So this is Day convolution over the coproduct.

type CoBesideSum (q1 :: k +-> k) (q2 :: k +-> k) = (Corep (Diag :: k +-> (k, k)) :.: (q1 :**: q2)) :.: Corep (PlusRep :: k -> (k, k) -> Type) Source Github #

The covariant half of the BesideSum witness pair.

data UnitW (s :: k) (x :: k) where Source Github #

Witness pair with no foci at all: decompose to Unit and rebuild.

UnitW and CoUnitW are the halves of DayUnit, one per side, with a phantom focus; with Beside/CoBeside they are the Day-monoidal structure on profunctors split at the focus. The split is forced: a whole DayUnit on the decomposition side would demand Unit ~> a for an arbitrary focus a.

Unlike Beside this is not a composite: the nullary analogue would pass through the unit category (), which can coincide with k and so overlap the generic composition instances.

Constructors

UnitW :: forall {k} (x :: k) (s :: k). Ob x => (s ~> (Unit :: k)) -> UnitW s x 

Instances

Instances details
Monoidal k => Profunctor (UnitW :: k -> k -> Type) Source Github # 
Instance details

Defined in Proarrow.Optic.Traversal

Methods

dimap :: forall (c :: k) (a :: k) (b :: k) (d :: k). (c ~> a) -> (b ~> d) -> UnitW a b -> UnitW c d Source Github #

lmap :: forall (c :: k) (a :: k) (b :: k). (c ~> a) -> UnitW a b -> UnitW c b Source Github #

rmap :: forall (b :: k) (d :: k) (a :: k). (b ~> d) -> UnitW a b -> UnitW a d Source Github #

(\\) :: forall (a :: k) (b :: k) r. ((Ob a, Ob b) => r) -> UnitW a b -> r Source Github #

Monoidal k => Proadjunction (UnitW :: k -> k -> Type) (CoUnitW :: k -> k -> Type) Source Github # 
Instance details

Defined in Proarrow.Optic.Traversal

Methods

unit :: forall (a :: k). Ob a => ((CoUnitW :: k -> k -> Type) :.: (UnitW :: k -> k -> Type)) a a Source Github #

counit :: ((UnitW :: k -> k -> Type) :.: (CoUnitW :: k -> k -> Type)) :~> ((~>) :: CAT k) Source Github #

Monoidal k => FoldFl (UnitW :: k -> k -> Type) (CoUnitW :: k -> k -> Type) Source Github # 
Instance details

Defined in Proarrow.Optic.Traversal

Methods

foldMapP :: forall (m :: k) (s :: k) (a :: k). Monoid m => UnitW s a -> (a ~> m) -> s ~> m Source Github #

Monoidal k => SetterFl (UnitW :: k -> k -> Type) (CoUnitW :: k -> k -> Type) Source Github # 
Instance details

Defined in Proarrow.Optic.Traversal

Methods

overP :: forall (s :: k) (a :: k) (b :: k) (t :: k). UnitW s a -> CoUnitW b t -> (a ~> b) -> s ~> t Source Github #

Monoidal k => MonTravFl (UnitW :: k -> k -> Type) (CoUnitW :: k -> k -> Type) Source Github # 
Instance details

Defined in Proarrow.Optic.Traversal

Methods

monTravP :: forall r (s :: k) (a :: k) (b :: k) (t :: k). StrongDistributiveProfunctor r => UnitW s a -> CoUnitW b t -> r a b -> r s t Source Github #

Monoidal k => TravFl (UnitW :: k -> k -> Type) (CoUnitW :: k -> k -> Type) Source Github # 
Instance details

Defined in Proarrow.Optic.Traversal

Methods

travP :: forall r (s :: k) (a :: k) (b :: k) (t :: k). (StrongDistributiveProfunctor r, Strong (ProdAction :: k -> (PROD k, k) -> Type) r) => UnitW s a -> CoUnitW b t -> r a b -> r s t Source Github #

data CoUnitW (x :: k) (t :: k) where Source Github #

The covariant half of the UnitW witness pair: rebuilds the target from Unit.

Constructors

CoUnitW :: forall {k} (x :: k) (t :: k). Ob x => ((Unit :: k) ~> t) -> CoUnitW x t 

Instances

Instances details
Monoidal k => Profunctor (CoUnitW :: k -> k -> Type) Source Github # 
Instance details

Defined in Proarrow.Optic.Traversal

Methods

dimap :: forall (c :: k) (a :: k) (b :: k) (d :: k). (c ~> a) -> (b ~> d) -> CoUnitW a b -> CoUnitW c d Source Github #

lmap :: forall (c :: k) (a :: k) (b :: k). (c ~> a) -> CoUnitW a b -> CoUnitW c b Source Github #

rmap :: forall (b :: k) (d :: k) (a :: k). (b ~> d) -> CoUnitW a b -> CoUnitW a d Source Github #

(\\) :: forall (a :: k) (b :: k) r. ((Ob a, Ob b) => r) -> CoUnitW a b -> r Source Github #

Monoidal k => Proadjunction (UnitW :: k -> k -> Type) (CoUnitW :: k -> k -> Type) Source Github # 
Instance details

Defined in Proarrow.Optic.Traversal

Methods

unit :: forall (a :: k). Ob a => ((CoUnitW :: k -> k -> Type) :.: (UnitW :: k -> k -> Type)) a a Source Github #

counit :: ((UnitW :: k -> k -> Type) :.: (CoUnitW :: k -> k -> Type)) :~> ((~>) :: CAT k) Source Github #

Monoidal k => FoldFl (UnitW :: k -> k -> Type) (CoUnitW :: k -> k -> Type) Source Github # 
Instance details

Defined in Proarrow.Optic.Traversal

Methods

foldMapP :: forall (m :: k) (s :: k) (a :: k). Monoid m => UnitW s a -> (a ~> m) -> s ~> m Source Github #

Monoidal k => SetterFl (UnitW :: k -> k -> Type) (CoUnitW :: k -> k -> Type) Source Github # 
Instance details

Defined in Proarrow.Optic.Traversal

Methods

overP :: forall (s :: k) (a :: k) (b :: k) (t :: k). UnitW s a -> CoUnitW b t -> (a ~> b) -> s ~> t Source Github #

Monoidal k => MonTravFl (UnitW :: k -> k -> Type) (CoUnitW :: k -> k -> Type) Source Github # 
Instance details

Defined in Proarrow.Optic.Traversal

Methods

monTravP :: forall r (s :: k) (a :: k) (b :: k) (t :: k). StrongDistributiveProfunctor r => UnitW s a -> CoUnitW b t -> r a b -> r s t Source Github #

Monoidal k => TravFl (UnitW :: k -> k -> Type) (CoUnitW :: k -> k -> Type) Source Github # 
Instance details

Defined in Proarrow.Optic.Traversal

Methods

travP :: forall r (s :: k) (a :: k) (b :: k) (t :: k). (StrongDistributiveProfunctor r, Strong (ProdAction :: k -> (PROD k, k) -> Type) r) => UnitW s a -> CoUnitW b t -> r a b -> r s t Source Github #

data ZeroW (s :: k) (x :: k) where Source Github #

Witness pair for the impossible case: decompose to the initial object. These are the halves of the (unspelled) unit of Day convolution over the coproduct monoidal structure, cf. UnitW/CoUnitW.

Constructors

ZeroW :: forall {k} (x :: k) (s :: k). Ob x => (s ~> (InitialObject :: k)) -> ZeroW s x 

Instances

Instances details
HasInitialObject k => Profunctor (ZeroW :: k -> k -> Type) Source Github # 
Instance details

Defined in Proarrow.Optic.Traversal

Methods

dimap :: forall (c :: k) (a :: k) (b :: k) (d :: k). (c ~> a) -> (b ~> d) -> ZeroW a b -> ZeroW c d Source Github #

lmap :: forall (c :: k) (a :: k) (b :: k). (c ~> a) -> ZeroW a b -> ZeroW c b Source Github #

rmap :: forall (b :: k) (d :: k) (a :: k). (b ~> d) -> ZeroW a b -> ZeroW a d Source Github #

(\\) :: forall (a :: k) (b :: k) r. ((Ob a, Ob b) => r) -> ZeroW a b -> r Source Github #

HasInitialObject k => Proadjunction (ZeroW :: k -> k -> Type) (CoZeroW :: k -> k -> Type) Source Github # 
Instance details

Defined in Proarrow.Optic.Traversal

Methods

unit :: forall (a :: k). Ob a => ((CoZeroW :: k -> k -> Type) :.: (ZeroW :: k -> k -> Type)) a a Source Github #

counit :: ((ZeroW :: k -> k -> Type) :.: (CoZeroW :: k -> k -> Type)) :~> ((~>) :: CAT k) Source Github #

HasInitialObject k => FoldFl (ZeroW :: k -> k -> Type) (CoZeroW :: k -> k -> Type) Source Github # 
Instance details

Defined in Proarrow.Optic.Traversal

Methods

foldMapP :: forall (m :: k) (s :: k) (a :: k). Monoid m => ZeroW s a -> (a ~> m) -> s ~> m Source Github #

HasInitialObject k => SetterFl (ZeroW :: k -> k -> Type) (CoZeroW :: k -> k -> Type) Source Github # 
Instance details

Defined in Proarrow.Optic.Traversal

Methods

overP :: forall (s :: k) (a :: k) (b :: k) (t :: k). ZeroW s a -> CoZeroW b t -> (a ~> b) -> s ~> t Source Github #

HasInitialObject k => MonTravFl (ZeroW :: k -> k -> Type) (CoZeroW :: k -> k -> Type) Source Github # 
Instance details

Defined in Proarrow.Optic.Traversal

Methods

monTravP :: forall r (s :: k) (a :: k) (b :: k) (t :: k). StrongDistributiveProfunctor r => ZeroW s a -> CoZeroW b t -> r a b -> r s t Source Github #

HasInitialObject k => TravFl (ZeroW :: k -> k -> Type) (CoZeroW :: k -> k -> Type) Source Github # 
Instance details

Defined in Proarrow.Optic.Traversal

Methods

travP :: forall r (s :: k) (a :: k) (b :: k) (t :: k). (StrongDistributiveProfunctor r, Strong (ProdAction :: k -> (PROD k, k) -> Type) r) => ZeroW s a -> CoZeroW b t -> r a b -> r s t Source Github #

data CoZeroW (x :: k) (t :: k) where Source Github #

The covariant half of the ZeroW witness pair: rebuilds the target from InitialObject.

Constructors

CoZeroW :: forall {k} (x :: k) (t :: k). Ob x => ((InitialObject :: k) ~> t) -> CoZeroW x t 

Instances

Instances details
HasInitialObject k => Profunctor (CoZeroW :: k -> k -> Type) Source Github # 
Instance details

Defined in Proarrow.Optic.Traversal

Methods

dimap :: forall (c :: k) (a :: k) (b :: k) (d :: k). (c ~> a) -> (b ~> d) -> CoZeroW a b -> CoZeroW c d Source Github #

lmap :: forall (c :: k) (a :: k) (b :: k). (c ~> a) -> CoZeroW a b -> CoZeroW c b Source Github #

rmap :: forall (b :: k) (d :: k) (a :: k). (b ~> d) -> CoZeroW a b -> CoZeroW a d Source Github #

(\\) :: forall (a :: k) (b :: k) r. ((Ob a, Ob b) => r) -> CoZeroW a b -> r Source Github #

HasInitialObject k => Proadjunction (ZeroW :: k -> k -> Type) (CoZeroW :: k -> k -> Type) Source Github # 
Instance details

Defined in Proarrow.Optic.Traversal

Methods

unit :: forall (a :: k). Ob a => ((CoZeroW :: k -> k -> Type) :.: (ZeroW :: k -> k -> Type)) a a Source Github #

counit :: ((ZeroW :: k -> k -> Type) :.: (CoZeroW :: k -> k -> Type)) :~> ((~>) :: CAT k) Source Github #

HasInitialObject k => FoldFl (ZeroW :: k -> k -> Type) (CoZeroW :: k -> k -> Type) Source Github # 
Instance details

Defined in Proarrow.Optic.Traversal

Methods

foldMapP :: forall (m :: k) (s :: k) (a :: k). Monoid m => ZeroW s a -> (a ~> m) -> s ~> m Source Github #

HasInitialObject k => SetterFl (ZeroW :: k -> k -> Type) (CoZeroW :: k -> k -> Type) Source Github # 
Instance details

Defined in Proarrow.Optic.Traversal

Methods

overP :: forall (s :: k) (a :: k) (b :: k) (t :: k). ZeroW s a -> CoZeroW b t -> (a ~> b) -> s ~> t Source Github #

HasInitialObject k => MonTravFl (ZeroW :: k -> k -> Type) (CoZeroW :: k -> k -> Type) Source Github # 
Instance details

Defined in Proarrow.Optic.Traversal

Methods

monTravP :: forall r (s :: k) (a :: k) (b :: k) (t :: k). StrongDistributiveProfunctor r => ZeroW s a -> CoZeroW b t -> r a b -> r s t Source Github #

HasInitialObject k => TravFl (ZeroW :: k -> k -> Type) (CoZeroW :: k -> k -> Type) Source Github # 
Instance details

Defined in Proarrow.Optic.Traversal

Methods

travP :: forall r (s :: k) (a :: k) (b :: k) (t :: k). (StrongDistributiveProfunctor r, Strong (ProdAction :: k -> (PROD k, k) -> Type) r) => ZeroW s a -> CoZeroW b t -> r a b -> r s t Source Github #

Van Laarhoven traversals

newtype Baz t b a Source Github #

The van Laarhoven form of a traversal with target t and new focus b, as a functor of the old focus a: run with any applicative handling of the foci.

Constructors

Baz 

Fields

Instances

Instances details
Functor (Baz t b) Source Github # 
Instance details

Defined in Proarrow.Optic.Traversal

Methods

fmap :: (a -> b0) -> Baz t b a -> Baz t b b0 Github #

(<$) :: a -> Baz t b b0 -> Baz t b a Github #

Foldable (Baz t b) Source Github # 
Instance details

Defined in Proarrow.Optic.Traversal

Methods

fold :: Monoid m => Baz t b m -> m Github #

foldMap :: Monoid m => (a -> m) -> Baz t b a -> m Github #

foldMap' :: Monoid m => (a -> m) -> Baz t b a -> m Github #

foldr :: (a -> b0 -> b0) -> b0 -> Baz t b a -> b0 Github #

foldr' :: (a -> b0 -> b0) -> b0 -> Baz t b a -> b0 Github #

foldl :: (b0 -> a -> b0) -> b0 -> Baz t b a -> b0 Github #

foldl' :: (b0 -> a -> b0) -> b0 -> Baz t b a -> b0 Github #

foldr1 :: (a -> a -> a) -> Baz t b a -> a Github #

foldl1 :: (a -> a -> a) -> Baz t b a -> a Github #

toList :: Baz t b a -> [a] Github #

null :: Baz t b a -> Bool Github #

length :: Baz t b a -> Int Github #

elem :: Eq a => a -> Baz t b a -> Bool Github #

maximum :: Ord a => Baz t b a -> a Github #

minimum :: Ord a => Baz t b a -> a Github #

sum :: Num a => Baz t b a -> a Github #

product :: Num a => Baz t b a -> a Github #

Traversable (Baz t b) Source Github #

Handle the foci, keeping the rest of the traversal: run at Compose f (Bazaar a' b).

Instance details

Defined in Proarrow.Optic.Traversal

Methods

traverse :: Applicative f => (a -> f b0) -> Baz t b a -> f (Baz t b b0) Github #

sequenceA :: Applicative f => Baz t b (f a) -> f (Baz t b a) Github #

mapM :: Monad m => (a -> m b0) -> Baz t b a -> m (Baz t b b0) Github #

sequence :: Monad m => Baz t b (m a) -> m (Baz t b a) Github #

newtype Bazaar a b t Source Github #

Constructors

Bazaar (forall (f :: Type -> Type). Applicative f => (a -> f b) -> f t) 

Instances

Instances details
Applicative (Bazaar a b) Source Github # 
Instance details

Defined in Proarrow.Optic.Traversal

Methods

pure :: a0 -> Bazaar a b a0 Github #

(<*>) :: Bazaar a b (a0 -> b0) -> Bazaar a b a0 -> Bazaar a b b0 Github #

liftA2 :: (a0 -> b0 -> c) -> Bazaar a b a0 -> Bazaar a b b0 -> Bazaar a b c Github #

(*>) :: Bazaar a b a0 -> Bazaar a b b0 -> Bazaar a b b0 Github #

(<*) :: Bazaar a b a0 -> Bazaar a b b0 -> Bazaar a b a0 Github #

Functor (Bazaar a b) Source Github # 
Instance details

Defined in Proarrow.Optic.Traversal

Methods

fmap :: (a0 -> b0) -> Bazaar a b a0 -> Bazaar a b b0 Github #

(<$) :: a0 -> Bazaar a b b0 -> Bazaar a b a0 Github #

sold :: Baz t b b -> t Source Github #

Rebuild the target once every focus has its new type: run at Identity.

fromTravVL :: forall s t a b. (forall (f :: Type -> Type). Applicative f => (a -> f b) -> s -> f t) -> Traversal s t a b Source Github #

Build a Traversal from a Prelude traversal such as traverse. Its witness is Star (Prelude (Baz t b)) with the function as the left leg, so this does no work; eliminating the result distributes the carrier through traverse at the witness.

Orphan instances

(FoldFl p1 q1, FoldFl p2 q2, Monoidal k) => FoldFl (Beside p1 p2 :: k -> k -> Type) (CoBeside q1 q2 :: k -> k -> Type) Source Github # 
Instance details

Methods

foldMapP :: forall (m :: k) (s :: k) (a :: k). Monoid m => Beside p1 p2 s a -> (a ~> m) -> s ~> m Source Github #

(FoldFl p1 q1, FoldFl p2 q2, HasBinaryCoproducts k) => FoldFl (BesideSum p1 p2 :: k -> k -> Type) (CoBesideSum q1 q2 :: k -> k -> Type) Source Github # 
Instance details

Methods

foldMapP :: forall (m :: k) (s :: k) (a :: k). Monoid m => BesideSum p1 p2 s a -> (a ~> m) -> s ~> m Source Github #

Comonoid m => FoldFl (Rep (ActionAt (Tensor :: k -> (k, k) -> Type) m) :: k -> k -> Type) (Corep (ActionAt (Tensor :: k -> (k, k) -> Type) m) :: k -> k -> Type) Source Github #

The tensor-action witness pair Rep/Corep (ActionAt Tensor m) with a comonoid residual m (legs s ~> m ** a, m ** b ~> t) is a (monoidal) traversal witness. It folds by discarding the residual with the counit, and distributes a StrongDistributiveProfunctor by its own strength act @Tensor, so neither product strength nor tensor = product is needed. Only m must be a Comonoid, so this works in LINEAR for the duplicable objects. It is also the monoidal-lens witness (Proarrow.Optic.MonoidalLens).

Instance details

Methods

foldMapP :: forall (m0 :: k) (s :: k) (a :: k). Monoid m0 => Rep (ActionAt (Tensor :: k -> (k, k) -> Type) m) s a -> (a ~> m0) -> s ~> m0 Source Github #

(SetterFl p1 q1, SetterFl p2 q2, Monoidal k) => SetterFl (Beside p1 p2 :: k -> k -> Type) (CoBeside q1 q2 :: k -> k -> Type) Source Github # 
Instance details

Methods

overP :: forall (s :: k) (a :: k) (b :: k) (t :: k). Beside p1 p2 s a -> CoBeside q1 q2 b t -> (a ~> b) -> s ~> t Source Github #

(SetterFl p1 q1, SetterFl p2 q2, HasBinaryCoproducts k) => SetterFl (BesideSum p1 p2 :: k -> k -> Type) (CoBesideSum q1 q2 :: k -> k -> Type) Source Github # 
Instance details

Methods

overP :: forall (s :: k) (a :: k) (b :: k) (t :: k). BesideSum p1 p2 s a -> CoBesideSum q1 q2 b t -> (a ~> b) -> s ~> t Source Github #