[Haskell-cafe] Lenses and records and ecosystem

Tony Morris tonymorris at gmail.com
Fri Feb 10 07:10:21 UTC 2017

On 10/02/17 15:35, Anthony Clayden wrote:
> I see Simon PJ's comment here
> https://github.com/ghc-proposals/ghc-proposals/pull/6#issuecomment-277971802
> and the lengthy discussions from different advocates.
> How much is it true there's a fractured "Haskell ecosystem" 
> with 2 (3?) incompatible approaches:
> * H98 style labelled records with various extensions to ease
> the pain.
> * newtype-wrapped Lenses
> * 'raw' (unwrapped) Lenses

Yearss ago, many of us spent a long time on different designs of lenses,
running up against different and diverse walls, arguing amongst
ourselves. The result is that there appears to be agreement on where
those deeper problems actually are. We also seem to agree that the lens
package at least correctly identifies the problems and excitingly, even
resolves them in many cases. This was a significant step forward at the
time and it would be foolish to concede that ground for no significant

> Can you mix those three styles inside one program? How much
> pain does it cause?
> Can you import libraries with a mix of styles? How does a
> program cope?

Why would you? For what practical purpose?

> I see the plethora of operators Lenses come with
>  (mostly to keep the types coherent?). 
> Except that Lens composition is plain function composition
> (.).
> I remember something from SPJ's video/lecture on Lenses: 
> that having Lens composition turn out to be function
> composition is "cute". 

The use of (.) here was deliberately designed that way to assist in
working against existing code.

> That suggests to me it's more of a happy accident than a
> necessary feature.

Not necessary, just useful. I am less excited about this feature than
many others, but it is useful nonetheless, and was specifically designed
that way.

> I also see in the ORF proposal, OverloadedLabels part, 
> that composing with Control.Category.(.) can lead to type
> ambiguity.
> I wonder:
> Could there be a dedicated operator for composing Lenses,
> that has the same semantics as (.),
> but a more specialised type?
> To strengthen type inference/reduce ambiguity.
> AntC
> _______________________________________________
> 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.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20170210/07e88bd7/attachment.sig>

More information about the Haskell-Cafe mailing list