O(n+m). Difference with a combining function. When two equal
keys are encountered, the combining function is applied to the values
of these keys. If it returns
Nothing, the element is discarded
(proper set difference). If it returns (
Just y), the
element is updated with a new value
y.
Returns a potentially empty map (
Map), in case the first map is
a subset of the second map and the function returns
Nothing for
every pair.
let f al ar = if al == "b" then Just (al ++ ":" ++ ar) else Nothing
differenceWith f (fromList ((5, "a") :| [(3, "b")])) (fromList ((5, "A") :| [(3, "B"), (7, "C")]))
== Data.Map.singleton 3 "b:B"