Discussion: reconsider lens-like exports from containers

David Feuer david.feuer at gmail.com
Tue Apr 26 20:47:23 UTC 2016

I *believe* that the [] Applicative will prove that adjustA is sometimes
more efficient than any implementation built on the current API. In that
context, it should be possible to descend to a leaf once and then ascend
from it many times.

foo n xs = adjustA f n xs where
  f :: Char -> [Char]
  f x = ...

This only travels to the nth element once and effectively saves the path to
that spot so it can produce many sequences where that element is different.
You could do something conceptually similar by splitting the sequence at
that point and putting the pieces together many times, but in practice that
would be awful.
On Apr 26, 2016 3:18 PM, "Marcin Mrotek" <marcin.jan.mrotek at gmail.com>


I don't feel qualified to take a stance on this, but since you did make a
comment about "deafening silence" earlier on an unrelated issue, then, if
this `adjustA` doesn't depend on any particular Lens library, and it's more
efficient than any hand-rolled solution, then why not?

Best regards,
Marcin Mrotek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20160426/f4e9f009/attachment.html>

More information about the Libraries mailing list