| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Proarrow.Optic.Getter
Description
The getter and its mirror the review: the one-leg optics s (~> aGetterFl /
getP) and b (its ~> tFlip). A getter is an affine fold that always succeeds; a review
is what remains of a prism's build leg. Build them from a single morphism with to / unto,
and eliminate with view / (^.) and review / (#), via the generic ExOptic carrier.
Synopsis
- class AffineFoldFl p q => GetterFl (p :: k +-> k) (q :: j +-> j) where
- type Getter (s :: k) (t :: j) (a :: k) (b :: j) = Optic (Prostrong (GetterFl :: (k +-> k) -> (j +-> j) -> Constraint)) s t a b
- view :: forall {j} {k} (c :: (k -> j -> Type) -> Constraint) (s :: k) (t :: j) (a :: k) (b :: j). (CategoryOf j, CategoryOf k, (Ob a, Ob b) => c (ExOptic (GetterFl :: (k +-> k) -> (j +-> j) -> Constraint) a b)) => Optic c s t a b -> s ~> a
- (^.) :: forall (c :: (Type -> Type -> Type) -> Constraint) a b s t. c (ExOptic (GetterFl :: (Type +-> Type) -> (Type +-> Type) -> Constraint) a b) => s -> Optic c s t a b -> a
- to :: forall {k} {j} (s :: k) (t :: j) (a :: k) (b :: j). (CategoryOf k, CategoryOf j, Ob b, Ob t) => (s ~> a) -> Getter s t a b
- type Review (s :: k) (t :: j) (a :: k) (b :: j) = Optic (Prostrong (Flip (GetterFl :: (j +-> j) -> (k +-> k) -> Constraint))) s t a b
- review :: forall {j} {k} (c :: (k -> j -> Type) -> Constraint) (s :: k) (t :: j) (a :: k) (b :: j). (CategoryOf j, CategoryOf k, (Ob a, Ob b) => c (ExOptic (Flip (GetterFl :: (j +-> j) -> (k +-> k) -> Constraint)) a b)) => Optic c s t a b -> b ~> t
- (#) :: forall (c :: (Type -> Type -> Type) -> Constraint) a b s t. c (ExOptic (Flip (GetterFl :: (Type +-> Type) -> (Type +-> Type) -> Constraint)) a b) => Optic c s t a b -> b -> t
- unto :: forall {k} {j} (s :: k) (t :: j) (a :: k) (b :: j). (CategoryOf k, CategoryOf j, Ob s, Ob a) => (b ~> t) -> Review s t a b
Documentation
class AffineFoldFl p q => GetterFl (p :: k +-> k) (q :: j +-> j) where Source Github #
Instances
| (CategoryOf k, CategoryOf j) => GetterFl (Id :: k -> k -> Type) (Id :: j -> j -> Type) Source Github # | |
| (CategoryOf k, CategoryOf j) => GetterFl (Id :: k -> k -> Type) (TerminalProfunctor :: j -> j -> Type) Source Github # | |
| (HasCoproducts k, Ob t) => GetterFl (Corep (Coproduct t) :: k -> k -> Type) (Rep (Coproduct t) :: k -> k -> Type) Source Github # | |
| Comonoid m => GetterFl (Rep (ActionAt (Tensor :: k -> (k, k) -> Type) m) :: k -> k -> Type) (Corep (ActionAt (Tensor :: k -> (k, k) -> Type) m) :: k -> k -> Type) Source Github # | |
| (HasBinaryProducts k, Ob s) => GetterFl (Rep (Product s) :: k -> k -> Type) (Corep (Product s) :: k -> k -> Type) Source Github # | |
| (GetterFl f g, GetterFl f' g') => GetterFl (f :.: f' :: k -> k -> Type) (g' :.: g :: j -> j -> Type) Source Github # | |
type Getter (s :: k) (t :: j) (a :: k) (b :: j) = Optic (Prostrong (GetterFl :: (k +-> k) -> (j +-> j) -> Constraint)) s t a b Source Github #
view :: forall {j} {k} (c :: (k -> j -> Type) -> Constraint) (s :: k) (t :: j) (a :: k) (b :: j). (CategoryOf j, CategoryOf k, (Ob a, Ob b) => c (ExOptic (GetterFl :: (k +-> k) -> (j +-> j) -> Constraint) a b)) => Optic c s t a b -> s ~> a Source Github #
(^.) :: forall (c :: (Type -> Type -> Type) -> Constraint) a b s t. c (ExOptic (GetterFl :: (Type +-> Type) -> (Type +-> Type) -> Constraint) a b) => s -> Optic c s t a b -> a infixl 8 Source Github #
View the focus of a concrete, Type-level optic.
to :: forall {k} {j} (s :: k) (t :: j) (a :: k) (b :: j). (CategoryOf k, CategoryOf j, Ob b, Ob t) => (s ~> a) -> Getter s t a b Source Github #
type Review (s :: k) (t :: j) (a :: k) (b :: j) = Optic (Prostrong (Flip (GetterFl :: (j +-> j) -> (k +-> k) -> Constraint))) s t a b Source Github #
review :: forall {j} {k} (c :: (k -> j -> Type) -> Constraint) (s :: k) (t :: j) (a :: k) (b :: j). (CategoryOf j, CategoryOf k, (Ob a, Ob b) => c (ExOptic (Flip (GetterFl :: (j +-> j) -> (k +-> k) -> Constraint)) a b)) => Optic c s t a b -> b ~> t Source Github #
Review through any optic that can act as a review, in either encoding: getP on the flipped
witness pair.
(#) :: forall (c :: (Type -> Type -> Type) -> Constraint) a b s t. c (ExOptic (Flip (GetterFl :: (Type +-> Type) -> (Type +-> Type) -> Constraint)) a b) => Optic c s t a b -> b -> t infixr 8 Source Github #
Review through a concrete, Type-level optic.
unto :: forall {k} {j} (s :: k) (t :: j) (a :: k) (b :: j). (CategoryOf k, CategoryOf j, Ob s, Ob a) => (b ~> t) -> Review s t a b Source Github #