[Haskell-cafe] ANNOUNCE: lens-family 2.0.0 anniversary edition!

roconnor at theorem.ca roconnor at theorem.ca
Sat Jul 20 19:48:26 UTC 2019

On Fri, 19 Jul 2019, Carter Schonwald wrote:

> Hey Russell, is there any expository or tech reporty exposition of the differences in formulation and the why's wherefores of the new major release? (i'm genuinely curious since i'm quite
> wimpy in the lens foo)

There hasn't been a change in formulation of used in lens-family, rather 
the grate-like and adapter-like new formulations have been added along 

Perhaps you are asking about the different formulations between different 
lens libraries?  I'm not sure what the best expositions are.  "Profunctor 
Optics: Modular Data Accessors" by Pickering, Gibbons, and Wu at 
seems like a reasonably good presentation of the implementations.

A library user is somewhat insualted from the details of the different 
implementations through the library combinators, but some differences 
remain.  For example, in lens-family's van Laarhoven implementation, I 
require explicit casting between Grate-like, Adatper-like, and Lens-like 
optics, whereas a profunctor based implementation would treat all three 
class of optics uniformly.  That said, you could have a van Laarhoven 
implementaion that uses Adapter-like for all optics and keep Identity 
functor wrappers around.  This isn't done in lens-family in order to keep 
backwards compatibility with the original Lens-like optics.

I've put out a new relase because I've started using grid optics in my 
own work.  For example, I use 'bend' to create bit-wise parsing of 256-bit 
hash values @ 
and I use an 'fe' grid @ 
to create instances of Arbitrary @ 

As far as I know, Kmett's lens library doesn't yet have much support for 
grates and grids, but I'm sure that will change.

That said, a good tutorial on how to program with these new grates and 
grid optics would be useful.  Unfortunately, I think these will take time 
to be developed.

Russell O'Connor                                      <http://r6.ca/>
``My friends, love is better than anger.  Hope is better than fear.
Optimism is better than dispair.  So let us be loving, hopeful and
optimistic.  And we'll change the world.'' -- Jack Layton

More information about the Haskell-Cafe mailing list