Profunctor Optics: Modular Data Accessors
Matthew Pickering (University of Bristol, United Kingdom), Jeremy, Gibbons (University of Oxford, United Kingdom), Nicolas Wu (University of, Bristol, United Kingdom)

TL;DR
This paper introduces a modular framework for data accessors using profunctors, enabling composition of complex data accessors from simpler ones, with implementations in Haskell and proofs of their properties.
Contribution
It presents a novel profunctor-based approach to make data accessors first-class and composable, improving modularity in data structure manipulation.
Findings
Framework successfully composes complex data accessors
Implementations provided in Haskell with accompanying proofs
Data accessors are now first-class and easily combinable
Abstract
CONTEXT: Data accessors allow one to read and write components of a data structure, such as the fields of a record, the variants of a union, or the elements of a container. These data accessors are collectively known as optics; they are fundamental to programs that manipulate complex data. INQUIRY: Individual data accessors for simple data structures are easy to write, for example as pairs of "getter" and "setter" methods. However, it is not obvious how to combine data accessors, in such a way that data accessors for a compound data structure are composed out of smaller data accessors for the parts of that structure. Generally, one has to write a sequence of statements or declarations that navigate step by step through the data structure, accessing one level at a time - which is to say, data accessors are traditionally not first-class citizens, combinable in their own right. APPROACH:…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
