Discussion: reconsider lens-like exports from containers

Edward Kmett ekmett at gmail.com
Wed Apr 27 22:12:17 UTC 2016


For cases were the Functor winds up particularly complicated or won't
be known at compile time so the inlining can't help, it turns out you
can usually work around this with the 'fusing' combinator from the
lens library. This works around the repeated stacks of `fmap` that get
built up otherwise, transforming everything into one gigantic fmap all
in one go.

There is a similar `confusing` combinator for working with traversals.
The implementation lives up to the name.

-Edward

On Wed, Apr 27, 2016 at 5:19 PM,  <rf at rufflewind.com> wrote:
> On Tue, Apr 26, 2016, at 15:03, David Feuer wrote:
>> 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.
>
> Funny thing, I just tried doing that not to long ago with `at`:
>
> https://github.com/haskell/containers/pull/192
>
> In the end, the results were mixed.  It was a small optimization in some
> situations, and a moderate pessimization in others (esp. when the
> Functor becomes too complex for GHC to optimize).
>
> --
> RF
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries


More information about the Libraries mailing list