Argument order for Data.Map.adjustF
Ivan Lazar Miljenovic
ivan.miljenovic at gmail.com
Sat May 7 22:24:29 UTC 2016
On 8 May 2016 at 06:45, David Feuer <david.feuer at gmail.com> wrote:
> I managed to find an implementation of Control.Lens.At.at for Data.Map
> that's fast enough to be useful. The function will be named alterF to match
> the name of Data.Map.alter. The remaining question is what order the
> arguments should go in. I had thought to follow those of alter for
> consistency, giving
>
> alterF :: (Functor f, Ord k) => (Maybe a -> f (Maybe a)) -> k -> Map k a ->
> f (Map k a)
>
> Edward Kmett thinks the ergonomics of that order are terrible, and prefers
> to follow lens at, giving
>
> alterF :: (Functor f, Ord k) => k -> (Maybe a -> f (Maybe a)) -> Map k a ->
> f (Map k a)
>
> How do other people feel about this?
I have a slight preference for the first one as I'm more likely to be
applying the same function over multiple keys than having the same key
being altered with different functions.
>
> David Feuer
>
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>
--
Ivan Lazar Miljenovic
Ivan.Miljenovic at gmail.com
http://IvanMiljenovic.wordpress.com
More information about the Libraries
mailing list