Profunctor Optics, a Categorical Update
arXiv:2001.07488 · doi:10.32408/compositionality-6-1
Abstract
Optics are bidirectional data accessors that capture data transformation patterns such as accessing subfields or iterating over containers. Profunctor optics are a particular choice of representation supporting modularity, meaning that we can construct accessors for complex structures by combining simpler ones. Profunctor optics have previously been studied only in an unenriched and non-mixed setting, in which both directions of access are modelled in the same category. However, functional programming languages are arguably better described by enriched categories; and we have found that some structures in the literature are actually mixed optics, with access directions modelled in different categories. Our work generalizes a classic result by Pastro and Street on Tambara theory and uses it to describe mixed V-enriched profunctor optics and to endow them with V-category structure. We provide some original families of optics and derivations, including an elementary one for traversals. Finally, we discuss a Haskell implementation.
arXiv comment38 pages. Final version with Compositionality metadata, does not change theorem numbering
References in corpus (11)
- Coend calculus
- Profunctor Optics: Modular Data Accessors
- A unified framework for generalized multicategories
- Open Diagrams via Coend Calculus
- Categories of Optics
- An Investigation of the Laws of Traversals
- Reflections on Monadic Lenses
- Lenses and Learners
- Profunctor optics and traversals
- Generalized Lens Categories via functors
- Understanding Profunctor Optics: a representation theorem
Cited by in corpus (12)
- Coend calculus
- Towards Foundations of Categorical Cybernetics
- Bayesian Updates Compose Optically
- Category Theory in Machine Learning
- Cyber Kittens, or Some First Steps Towards Categorical Cybernetics
- Compositional Semantics for Probabilistic Programs with Exact Conditioning
- Reinforcement Learning in Categorical Cybernetics
- A unified implementation of automata and expression structures, and of the associated algorithms using enriched categories
- On a fibrational construction for optics, lenses, and Dialectica categories
- A Profunctorial Semantics for Quantum Supermaps
- On Graded Monads, Distributive Laws and Costrong Functors
- Learners are Almost Free Compact Closed