Discussion: reconsider lens-like exports from containers

David Feuer david.feuer at gmail.com
Tue Apr 26 19:03:59 UTC 2016


Way back when, Shachaf Ben-Kiki suggested an efficient implementation
of `at` for Data.Map in
https://mail.haskell.org/pipermail/libraries/2013-May/019761.html but
that was never approved for inclusion.


I believe I've come up with a somewhat nasty but efficient
implementation of `ix` for Data.Sequence (hand-specialized and
hand-unboxed), based on the code for `adjust`. See
https://gist.github.com/treeowl/b80c2c490563765fc7881be30f3dba24

lens has continued to grow in popularity, so I think the time has
probably come to talk again about adding `at` for Data.Map, and to
talk about adding `ix` for Data.Sequence.

Note: for consistency with the rest of the Data.Sequence API, `ix`
would be named `adjustA`, and would have its first two arguments
flipped.

David Feuer


More information about the Libraries mailing list