mapKeys f s is the map obtained by
applying
f to each key of
s.
The size of the result may be smaller if
f maps two or more
distinct keys to the same new key. In this case there is no guarantee
which of the associated values is chosen for the conflicting key.
>>> mapKeys (+ 1) (fromList [(5,"a"), (3,"b")])
fromList [(4,"b"),(6,"a")]
>>> mapKeys (\ _ -> 1) (fromList [(1,"b"), (2,"a"), (3,"d"), (4,"c")])
fromList [(1,"c")]
>>> mapKeys (\ _ -> 3) (fromList [(1,"b"), (2,"a"), (3,"d"), (4,"c")])
fromList [(3,"c")]