| ID | c11c190f-b88b-444f-be4f-be9e40317347 |
|---|---|
| DeertopiaVisibility | public |
Profunctor optic
Profunctor optics are one representation of optics that uses mappings between profunctors. In Haskell, these objects take the form of C p => p a b -> p s t.
Folklore
Quantity
In the folklore, there is an intuition for optics in VL representation to have a notion of quantity [cite:@hedges2025bidirectional].
Lenses have exactly one target. This is enforced by the functor constraint: you are given a continuation, k : a → f b, and must return a f t. Since there is no way to combine arbitrary functors, your only choice is to return something of form
_ <$> k _.Traversals have zero or more targets. This is provided by the applicative constaint, which offers identity (zero) as well as a way to combine multiple targets with the applicative action.