Bryce Clarke ; Derek Elkins ; Jeremy Gibbons ; Fosco Loregian ; Bartosz Milewski et al. - Profunctor Optics, a Categorical Update

compositionality:13530 - Compositionality, February 23, 2024, Volume 6 (2024) - https://doi.org/10.32408/compositionality-6-1
Profunctor Optics, a Categorical UpdateArticle

Authors: Bryce Clarke ORCID1; Derek Elkins ; Jeremy Gibbons ORCID2; Fosco Loregian ORCID3; Bartosz Milewski ORCID4; Emily Pillmore ; Mario Román ORCID2,3

  • 1 Macquarie University, School of Mathematics and Physical Sciences, New South Wales, NSW2109, Australia
  • 2 University of Oxford, Department of Computer Science, 7 Parks Rd, Oxford OX1 3QG, United Kingdom
  • 3 Tallinn University of Technology, Department of Software Sciences, Ehitajate tee 5, 19086 Tallinn, Estonia
  • 4 Programming Café

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.


Volume: Volume 6 (2024)
Published on: February 23, 2024
Imported on: May 2, 2024
Keywords: Computer Science - Programming Languages,Mathematics - Category Theory,18C50,D.3.1

Consultation statistics

This page has been seen 880 times.
This article's PDF has been downloaded 480 times.