ANNOUNCE: lens-family 2.0.0 anniversary edition!

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

ANNOUNCE: lens-family 2.0.0 anniversary edition!

roconnor
In celebration of the 10th anniversary of Twan van Laarhoven's seminal
blog post ``CPS based functional references''[1], I am releasing version
2.0 of lens-family[2] and lens-family-core[3] packages.  This new release
continues to explore the design of Van Laarhoven style optics with new
support for adapters, grates, grids[4], and prisms.

To bring support to these new optics necessarily means moving a little
further away from syntactic compatibility with Kmett's lens library.
In particular, lens-family's 'under' is unrelated to Kmett's lens
library's 'under' combinator.  Nonetheless the 'under' combinator plays
a crucial role in lens-family as a dual to the 'over' combinator and
this naming is hard to resist despite the conflict.

This new version comes with some minor incompatibilities with the version
1.2 library that may require user updates.
See <https://hackage.haskell.org/package/lens-family-2.0.0/changelog>.

[1]<https://www.twanvl.nl/blog/haskell/cps-functional-references>
[2]<https://hackage.haskell.org/package/lens-family-2.0.0>
[3]<https://hackage.haskell.org/package/lens-family-core-2.0.0>
[4]A grid is an optic that is both a grate and a traversal.

--
Russell O'Connor                                      <http://r6.ca/>
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
Reply | Threaded
Open this post in threaded view
|

Re: ANNOUNCE: lens-family 2.0.0 anniversary edition!

Carter Schonwald
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)

On Fri, Jul 19, 2019 at 10:53 AM <[hidden email]> wrote:
In celebration of the 10th anniversary of Twan van Laarhoven's seminal
blog post ``CPS based functional references''[1], I am releasing version
2.0 of lens-family[2] and lens-family-core[3] packages.  This new release
continues to explore the design of Van Laarhoven style optics with new
support for adapters, grates, grids[4], and prisms.

To bring support to these new optics necessarily means moving a little
further away from syntactic compatibility with Kmett's lens library.
In particular, lens-family's 'under' is unrelated to Kmett's lens
library's 'under' combinator.  Nonetheless the 'under' combinator plays
a crucial role in lens-family as a dual to the 'over' combinator and
this naming is hard to resist despite the conflict.

This new version comes with some minor incompatibilities with the version
1.2 library that may require user updates.
See <https://hackage.haskell.org/package/lens-family-2.0.0/changelog>.

[1]<https://www.twanvl.nl/blog/haskell/cps-functional-references>
[2]<https://hackage.haskell.org/package/lens-family-2.0.0>
[3]<https://hackage.haskell.org/package/lens-family-core-2.0.0>
[4]A grid is an optic that is both a grate and a traversal.

--
Russell O'Connor                                      <http://r6.ca/>
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.

_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
Reply | Threaded
Open this post in threaded view
|

Re: ANNOUNCE: lens-family 2.0.0 anniversary edition!

roconnor
In reply to this post by roconnor
On Fri, 19 Jul 2019, Artyom Kazak wrote:

> > Naturally, users can stick with the 1.2 release of lens-family if it
> > suits their needs.
> You can not easily have two versions of the same library in your dependency tree. So, only application developers will be able to stick to the 1.2 release without creating obstacles for
> the rest of the ecosystem.

I see.  I hadn't given that much consideration.  In that case, I apologize
for the inconvience this upgrade may cause.  I'll try to be more mindful
of this in the future.

--
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
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
Reply | Threaded
Open this post in threaded view
|

Re: ANNOUNCE: lens-family 2.0.0 anniversary edition!

roconnor
In reply to this post by Carter Schonwald
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
side.

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
<https://www.cs.ox.ac.uk/people/jeremy.gibbons/publications/poptics.pdf>
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 @
<https://github.com/ElementsProject/simplicity/blob/d1f8298b2ea557073e2358ac0b55cd70523694ad/Haskell/Simplicity/Digest.hs#L56>,
and I use an 'fe' grid @
<https://github.com/ElementsProject/simplicity/blob/67c838a7b31e7fc555a027950495775b2d506d66/Haskell/Simplicity/LibSecp256k1/Spec.hs#L68-L84>,
etc.
to create instances of Arbitrary @
<https://github.com/ElementsProject/simplicity/blob/67c838a7b31e7fc555a027950495775b2d506d66/Haskell/Simplicity/LibSecp256k1/FFI/Tests.hs#L82-L86>

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
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.