<p dir="ltr">I managed to find an implementation of <a href="http://Control.Lens.At.at">Control.Lens.At.at</a> 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</p>
<p dir="ltr">alterF :: (Functor f, Ord k) => (Maybe a -> f (Maybe a)) -> k -> Map k a -> f (Map k a)</p>
<p dir="ltr">Edward Kmett thinks the ergonomics of that order are terrible, and prefers to follow lens at, giving</p>
<p dir="ltr">alterF :: (Functor f, Ord k) => k -> (Maybe a -> f (Maybe a)) -> Map k a -> f (Map k a)</p>
<p dir="ltr">How do other people feel about this?</p>
<p dir="ltr">David Feuer</p>