| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Proarrow.Optic.Lens
Description
The lens: the optic for the categorical product, with legs
Lens s t a b = (s ~> a, (s && b) ~> t)
witnessed by /RepCorep( (Product s)LensFl / putP). The product residual is
the whole source s. A lens both views and sets, sitting below Getter
and AffineTraversal in the lattice. Build with lens (or from
the van-Laarhoven form with lensVL), eliminate to the two legs with withLens, via the
generic ExOptic carrier.
Synopsis
- class (AffineTravFl p q, GetterFl p q, GlassFl p q) => LensFl (p :: k +-> k) (q :: k +-> k) where
- putP :: forall (s :: k) (a :: k) (b :: k) (t :: k). HasBinaryProducts k => p s a -> q b t -> (s && b) ~> t
- type Lens (s :: k) (t :: k) (a :: k) (b :: k) = Optic (Prostrong (LensFl :: (k +-> k) -> (k +-> k) -> Constraint)) s t a b
- type Lens' (s :: k) (a :: k) = Lens s s a a
- lens :: forall {k} (s :: k) (t :: k) (a :: k) (b :: k). (HasBinaryProducts k, Ob b) => (s ~> a) -> ((s && b) ~> t) -> Lens s t a b
- withLens :: forall {k} (c :: (k -> k -> Type) -> Constraint) (s :: k) (t :: k) (a :: k) (b :: k) r. (HasBinaryProducts k, (Ob a, Ob b) => c (ExOptic (LensFl :: (k +-> k) -> (k +-> k) -> Constraint) a b)) => Optic c s t a b -> ((s ~> a) -> ((s && b) ~> t) -> r) -> r
- type LensVL s t a b = forall (f :: Type -> Type). Functor f => (a -> f b) -> s -> f t
- toLensVL :: Lens s t a b -> LensVL s t a b
- lensVL :: LensVL s t a b -> Lens s t a b
Documentation
class (AffineTravFl p q, GetterFl p q, GlassFl p q) => LensFl (p :: k +-> k) (q :: k +-> k) where Source Github #
Methods
putP :: forall (s :: k) (a :: k) (b :: k) (t :: k). HasBinaryProducts k => p s a -> q b t -> (s && b) ~> t Source Github #
Like affineSet, but with a weaker constraint. Lens witnesses only ever need binary
products, so lenses stay usable in categories without coproducts.
Instances
| CategoryOf k => LensFl (Id :: k -> k -> Type) (Id :: k -> k -> Type) Source Github # | |
Defined in Proarrow.Optic.Lens | |
| (HasBinaryProducts k, Ob s) => LensFl (Rep (Product s) :: k -> k -> Type) (Corep (Product s) :: k -> k -> Type) Source Github # | |
| (LensFl f g, LensFl f' g') => LensFl (f :.: f' :: i -> i -> Type) (g' :.: g :: i -> i -> Type) Source Github # | |
Defined in Proarrow.Optic.Lens | |
type Lens (s :: k) (t :: k) (a :: k) (b :: k) = Optic (Prostrong (LensFl :: (k +-> k) -> (k +-> k) -> Constraint)) s t a b Source Github #
lens :: forall {k} (s :: k) (t :: k) (a :: k) (b :: k). (HasBinaryProducts k, Ob b) => (s ~> a) -> ((s && b) ~> t) -> Lens s t a b Source Github #
withLens :: forall {k} (c :: (k -> k -> Type) -> Constraint) (s :: k) (t :: k) (a :: k) (b :: k) r. (HasBinaryProducts k, (Ob a, Ob b) => c (ExOptic (LensFl :: (k +-> k) -> (k +-> k) -> Constraint) a b)) => Optic c s t a b -> ((s ~> a) -> ((s && b) ~> t) -> r) -> r Source Github #