Talk on Lenses

Published: 2011-05-19T18:15Z
License: CC-BY

Two days ago I gave a talk on lenses at the Radboud Unviersity (where I work on my PhD on machine learning). I put the slides online for your enjoyment, although it might be hard to follow, since it is light on explanatory text.

This talk includes information from at least three different earlier blog posts, as well as Russel O'Connor's recent paper on multiplate. There is no new information in the talk, but I do have a new favorite representation for lenses.


Edward KmettDate: 2011-05-19T22:36Zx


Amusingly, I'm scheduled to give a talk at the next Boston Area Scala Enthusiasts meeting in a few days (the 26th) on lenses as well, although it is going to be pitched at a much more introductory level (most of the audience not being familiar with the State monad, for instance) with an emphasis on how you can use them in Scala to replace imperative code.

I presume your 'new favorite representation' is the functor based 'van Laarhoven' lenses near the end of your slide deck?

Twan van LaarhovenDate: 2011-05-20T19:24Zx

Interesting, Edward. Lenses are probably useful in Scala as well.

And you guessed wrong. My new favorite are the residual lenses. That is because they are very natural to think about, and because you get the lens laws for free.

I only called the Functor transformer lenses 'van Laarhoven lenses' because Russel does so in his multiplate paper. And because it is just very cool to have something named after yourself :)

Sjoerd VisscherDate: 2011-05-21T13:24Zx

The store zoo is a nice overview! And the question-marks were just begging to be investigated, so I've been playing with lenses with Alternative and Monad stores.

Alternative lenses are non-deterministic lenses: Monad van Laarhoven lenses can maintain invariants on the content:

My first guess what Monad lenses would be able to do was to look at IO, but it turns out MultiLenses are good enough for what I had in mind:


(optional, will not be revealed)
Name of the lazy functional programming language I write about:
Use > code for code blocks, @code@ for inline code. Some html is also allowed.