-
Couldn't load subscription status.
- Fork 186
Closed
Description
Maybe, I'm doing something wrong, but this combination is very frequent in my programms. Imagine we have some nested map
m :: Map Foo (Map Bar Baz)and we want to insert a value baz to the bar of foo. I think it would be nice to have something like
mupdate :: Monoid a => (a -> a) -> k -> Map k a -> Map k a
mupdate upd = alter (Just . upd . fromMaybe mempty)to call this like mupdate (insert bar baz) foo.
Maybe with upsert from #809 it will be also acceptable --- just upsert (insert bar baz . fromMaybe mempty) foo or even there is a perfect way using currently implemented functionality, but I can't see them.
P. S. of course, this can be easily done throw non from lens, but lens are not always advisable