| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Proarrow.Optic.Setter
Description
The setter: the weakest write-side optic, applying a morphism to every focus (SetterFl
/ overP). It sits at the write-only top of the subtyping lattice alongside
Fold, so it has no builder of its own (convert a stronger
optic). Its canonical eliminator is over, via the generic ExOptic carrier, with set,
(%~) and (.~) as shorthands.
This module also hosts the SetterFl instance of the tensor-action witness pair
/RepCorep(, shared by Proarrow.Optic.MonoidalTraversal and
Proarrow.Optic.Tracer.ActionAt Tensor a)
Synopsis
- class (Profunctor p, Profunctor q) => SetterFl (p :: k +-> k) (q :: k +-> k) where
- type Setter (s :: k) (t :: k) (a :: k) (b :: k) = Optic (Prostrong (SetterFl :: (k +-> k) -> (k +-> k) -> Constraint)) s t a b
- type Setter' (s :: k) (a :: k) = Setter s s a a
- over :: forall {k} (c :: (k -> k -> Type) -> Constraint) (s :: k) (t :: k) (a :: k) (b :: k). (CategoryOf k, (Ob a, Ob b) => c (ExOptic (SetterFl :: (k +-> k) -> (k +-> k) -> Constraint) a b)) => Optic c s t a b -> (a ~> b) -> s ~> t
- (%~) :: forall (c :: (Type -> Type -> Type) -> Constraint) a b s t. c (ExOptic (SetterFl :: (Type +-> Type) -> (Type +-> Type) -> Constraint) a b) => Optic c s t a b -> (a -> b) -> s -> t
- (.~) :: forall (c :: (Type -> Type -> Type) -> Constraint) a b s t. c (ExOptic (SetterFl :: (Type +-> Type) -> (Type +-> Type) -> Constraint) a b) => Optic c s t a b -> b -> s -> t
- set :: forall (c :: (Type -> Type -> Type) -> Constraint) a b s t. c (ExOptic (SetterFl :: (Type +-> Type) -> (Type +-> Type) -> Constraint) a b) => Optic c s t a b -> b -> s -> t
- mupdate :: Monad m => Setter ('KL s :: KLEISLI (Star (Prelude m))) ('KL t :: KLEISLI (Star (Prelude m))) ('KL a :: KLEISLI (Star (Prelude m))) ('KL b :: KLEISLI (Star (Prelude m))) -> b -> s -> m t
Documentation
class (Profunctor p, Profunctor q) => SetterFl (p :: k +-> k) (q :: k +-> k) where Source Github #
A setter can only apply a pure function to the a's it can see. It can neither view nor
fold them. A traversal is both a setter and a fold.
Methods
overP :: forall (s :: k) (a :: k) (b :: k) (t :: k). p s a -> q b t -> (a ~> b) -> s ~> t Source Github #
Instances
| Representable t => SetterFl (t :: k +-> k) (RepCostar t :: k -> k -> Type) Source Github # | Every representable residual is a setter: map the focus through the residual functor with
|
| Monoidal k => SetterFl (UnitW :: k -> k -> Type) (CoUnitW :: k -> k -> Type) Source Github # | |
| HasInitialObject k => SetterFl (ZeroW :: k -> k -> Type) (CoZeroW :: k -> k -> Type) Source Github # | |
| CategoryOf k => SetterFl (Id :: k -> k -> Type) (Id :: k -> k -> Type) Source Github # | |
| (Monoidal k, SNatI n) => SetterFl (Pow n :: k -> k -> Type) (CoPow n :: k -> k -> Type) Source Github # | |
| Corepresentable t => SetterFl (CorepStar t :: k -> k -> Type) (t :: k +-> k) Source Github # | Dually, every corepresentable residual is a setter: map with |
| (SetterFl p1 q1, SetterFl p2 q2, Monoidal k) => SetterFl (Beside p1 p2 :: k -> k -> Type) (CoBeside q1 q2 :: k -> k -> Type) 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 # | |
Defined in Proarrow.Optic.Traversal | |
| (TracedMonoidal k, Ob m) => SetterFl (Corep (ActionAt (Tensor :: k -> (k, k) -> Type) m) :: k -> k -> Type) (Rep (ActionAt (Tensor :: k -> (k, k) -> Type) m) :: k -> k -> Type) Source Github # | The tracer witness: the tensor-action pair read the other way round, |
| (Monoidal k, Ob a) => SetterFl (Rep (ActionAt (Tensor :: k -> (k, k) -> Type) a) :: k -> k -> Type) (Corep (ActionAt (Tensor :: k -> (k, k) -> Type) a) :: k -> k -> Type) Source Github # | The tensor-action witness pair |
| (Closed k, Ob m) => SetterFl (Rep (Exp m) :: k -> k -> Type) (Corep (Exp m) :: k -> k -> Type) Source Github # | The grate witness is a setter witness: map under the exponential. The |
| (HasCoproducts k, Ob t) => SetterFl (Rep (Coproduct t) :: k -> k -> Type) (Corep (Coproduct t) :: k -> k -> Type) Source Github # | |
| (HasBinaryProducts k, Ob s) => SetterFl (Rep (Product s) :: k -> k -> Type) (Corep (Product s) :: k -> k -> Type) Source Github # | |
| (SetterFl f g, SetterFl f' g') => SetterFl (f :.: f' :: i -> i -> Type) (g' :.: g :: i -> i -> Type) Source Github # | |
type Setter (s :: k) (t :: k) (a :: k) (b :: k) = Optic (Prostrong (SetterFl :: (k +-> k) -> (k +-> k) -> Constraint)) s t a b Source Github #
over :: forall {k} (c :: (k -> k -> Type) -> Constraint) (s :: k) (t :: k) (a :: k) (b :: k). (CategoryOf k, (Ob a, Ob b) => c (ExOptic (SetterFl :: (k +-> k) -> (k +-> k) -> Constraint) a b)) => Optic c s t a b -> (a ~> b) -> s ~> t Source Github #
(%~) :: forall (c :: (Type -> Type -> Type) -> Constraint) a b s t. c (ExOptic (SetterFl :: (Type +-> Type) -> (Type +-> Type) -> Constraint) a b) => Optic c s t a b -> (a -> b) -> s -> t infixl 8 Source Github #
Apply a function through a concrete, Type-level Setter.
(.~) :: forall (c :: (Type -> Type -> Type) -> Constraint) a b s t. c (ExOptic (SetterFl :: (Type +-> Type) -> (Type +-> Type) -> Constraint) a b) => Optic c s t a b -> b -> s -> t infixl 8 Source Github #
Replace the focus/foci of a concrete, Type-level Setter with a constant value.
set :: forall (c :: (Type -> Type -> Type) -> Constraint) a b s t. c (ExOptic (SetterFl :: (Type +-> Type) -> (Type +-> Type) -> Constraint) a b) => Optic c s t a b -> b -> s -> t Source Github #
Named version of (.~).
mupdate :: Monad m => Setter ('KL s :: KLEISLI (Star (Prelude m))) ('KL t :: KLEISLI (Star (Prelude m))) ('KL a :: KLEISLI (Star (Prelude m))) ('KL b :: KLEISLI (Star (Prelude m))) -> b -> s -> m t Source Github #
Monadically replace the focus/foci of a Setter in the Kleisli category of m with a
constant value, ignoring the old contents entirely.