String Diagrams for Optics

Author Guillaume Boisseau

Thumbnail PDF


  • Filesize: 496 kB
  • 18 pages

Document Identifiers

Author Details

Guillaume Boisseau
  • University of Oxford, UK


I want to thank the reviewers for the SYCO6 workshop for their thorough reviews, and Jeremy Gibbons for his ever helpful comments.

Cite AsGet BibTex

Guillaume Boisseau. String Diagrams for Optics. In 5th International Conference on Formal Structures for Computation and Deduction (FSCD 2020). Leibniz International Proceedings in Informatics (LIPIcs), Volume 167, pp. 17:1-17:18, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2020)


Optics are a data representation for compositional data access, with lenses as a popular special case. Hedges has presented a diagrammatic calculus for lenses, but in a way that does not generalize to other classes of optic. We present a calculus that works for all optics, not just lenses; this is done by embedding optics into their presheaf category, which naturally features string diagrams. We apply our calculus to the common case of lenses, extend it to effectful lenses, and explore how the laws of optics manifest in this setting.

Subject Classification

ACM Subject Classification
  • Software and its engineering → Visual languages
  • Software and its engineering → Data types and structures
  • Software and its engineering → Specialized application languages
  • Software and its engineering → Functional languages
  • Optic
  • string diagram
  • lens
  • category theory
  • Yoneda lemma


  • Access Statistics
  • Total Accesses (updated on a weekly basis)
    PDF Downloads


  1. Faris Abou-Saleh, James Cheney, Jeremy Gibbons, James McKinna, and Perdita Stevens. Reflections on Monadic Lenses. A List of Successes That Can Change the World, 9600:1-31, April 2016. URL:
  2. Guillaume Boisseau. String Diagrams for Optics. arXiv:2002.11480 [math], February 2020. URL:
  3. J. Nathan Foster, Michael B. Greenwald, Jonathan T. Moore, Benjamin C. Pierce, and Alan Schmitt. Combinators for bi-directional tree transformations: A linguistic approach to the view update problem. In Jens Palsberg and Martín Abadi, editors, Proceedings of the 32nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2005, Long Beach, California, USA, January 12-14, 2005, pages 233-246. ACM, 2005. URL:
  4. Jules Hedges. Coherence for lenses and open games. arXiv:1704.02230 [cs, math], September 2017. URL:
  5. Jules Hedges. Lenses for Philosophers, August 2018. URL:
  6. Jules Hedges. The game semantics of game theory. arXiv:1904.11287 [cs], April 2019. URL:
  7. André Joyal, Ross Street, and Dominic Verity. Traced monoidal categories. Mathematical Proceedings of the Cambridge Philosophical Society, 119(3):447-468, April 1996. URL:
  8. Aleks Kissinger and Sander Uijlen. A categorical semantics for causal structure. In 32nd Annual ACM/IEEE Symposium on Logic in Computer Science, LICS 2017, Reykjavik, Iceland, June 20-23, 2017, pages 1-12. IEEE Computer Society, 2017. URL:
  9. Edward Kmett. Haskell lens library, February 2020. URL:
  10. nLab authors. Actegory. URL:
  11. Russell O'Connor. Lenses Are Exactly the Coalgebras for the Store Comonad, November 2010. URL:
  12. Craig Pastro and Ross Street. Doubles for monoidal categories. Theory and Applications of Categories, 21, November 2007. URL:
  13. Matthew Pickering, Jeremy Gibbons, and Nicolas Wu. Profunctor optics: Modular data accessors. Programming Journal, 1(2):7, March 2017. URL:
  14. Mitchell Riley. Categories of Optics. arXiv:1809.00738 [math], September 2018. URL:
  15. Mario Román. Profunctor Optics and Traversals. Msc Thesis, University of Oxford, January 2020. URL:
Questions / Remarks / Feedback

Feedback for Dagstuhl Publishing

Thanks for your feedback!

Feedback submitted

Could not send message

Please try again later or send an E-mail