Profunctor optics are a neat and composable representation of bidirectional data accessors, including lenses, and their dual, prisms. The profunctor representation exploits higher-order functions and higher-kinded type constructor classes, but the relationship between this and the familiar representation in terms of 'getter' and 'setter' functions is not at all obvious.We derive the profunctor representation from the concrete representation, making the relationship clear. It turns out to be a fairly direct application of the Yoneda Lemma, arguably the most important result in category theory. We hope this derivation aids understanding of the profunctor representation. Conversely, it might also serve to provide some insight into the Yoneda Lemma.
CITATION STYLE
Boisseau, G., & Gibbons, J. (2018). What You Needa Know about Yoneda: Profunctor optics and the yoneda Lemma (Functional Pearl). Proceedings of the ACM on Programming Languages, 2(ICFP). https://doi.org/10.1145/3236779
Mendeley helps you to discover research relevant for your work.