1. 6

  2. 3

    For anyone interested, I wrote a lens library for JavaScript a few days ago:


    The first example can be written like so:

    var locationX = location.andThen(x);
    locationX.set(locationX.get() + 10);
    1. 1

      Michael Greenberg also published a JavaScript lenses library back in 2007, as part of his thesis at the University of Pennsylvania:


      It’s a bit dated now, to be sure, as there have since been many developments in the field of “bidirectional programming”. See, for example, Daniel Wagner’s paper on “Edit Lenses”: