<div dir="ltr">This might be a good case for having two names for the same function. Both use cases seem reasonable, and I don't really want containers to be too opinionated about the style of code using it.</div><span>
</span><br><div class="gmail_quote"><div dir="ltr">On Sat, May 7, 2016, 7:59 PM Edward Kmett <<a href="mailto:ekmett@gmail.com" target="_blank">ekmett@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I do agree that it would be more consistent to use the alter ordering,<br>
but I don't see many users who will reach for it as "generalized<br>
alter".<br>
<br>
Ultimately, I anticipate the major consumers of such a function would<br>
be people using some lens package, either through us changing the<br>
default definitions in lens to automatically use it on appropriate<br>
versions of containers, or through using a more minimalist lens<br>
package that doesn't provide lenses for containers -- most other<br>
people will neither find the new operation nor care.<br>
<br>
The former would require a flip for lens consumers to turn it back<br>
into a lens, making it much harder to recognize as such.<br>
<br>
-Edward<br>
<br>
On Sat, May 7, 2016 at 4:45 PM, David Feuer <<a href="mailto:david.feuer@gmail.com" target="_blank">david.feuer@gmail.com</a>> wrote:<br>
> I managed to find an implementation of <a href="http://Control.Lens.At.at" rel="noreferrer" target="_blank">Control.Lens.At.at</a> for Data.Map<br>
> that's fast enough to be useful. The function will be named alterF to match<br>
> the name of Data.Map.alter. The remaining question is what order the<br>
> arguments should go in. I had thought to follow those of alter for<br>
> consistency, giving<br>
><br>
> alterF :: (Functor f, Ord k) => (Maybe a -> f (Maybe a)) -> k -> Map k a -><br>
> f (Map k a)<br>
><br>
> Edward Kmett thinks the ergonomics of that order are terrible, and prefers<br>
> to follow lens at, giving<br>
><br>
> alterF :: (Functor f, Ord k) => k -> (Maybe a -> f (Maybe a)) -> Map k a -><br>
> f (Map k a)<br>
><br>
> How do other people feel about this?<br>
><br>
> David Feuer<br>
_______________________________________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org" target="_blank">Libraries@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
</blockquote></div>