Starting from two indexed categories, which encode what maps are allowed in the forward and backward directions, we define the category of dependent optics and establish under what assumptions it has coproducts. Different choices of indexed categories correspond to different families of optics: we discuss dependent lenses and prisms, as well as closed dependent optics. We introduce the notion of Tambara representation and use it to classify contravariant functors from the category of optics, thus generalizing the profunctor encoding of optics to the dependent case.
Dependent opticsClassically, a lens from a domain (X , X ′ ) to a codomain (Y,Y ′ ) has a get method get : X → Y and a put method put : X ×Y ′ → X ′ . This definition suggests two broad classes of generalizations. One approach, functor lenses [21], replaces the domain and codomain with pairs (X , P) and (Y, Q), where the objects