O(n).
traverseWithKey f m == fromList
$ traverse ((k, v) -> (v' -> v' `seq` (k,v'))
$ f k v) (toList m) That is, it behaves much like a
regular
traverse except that the traversing function also has
access to the key associated with a value and the values are forced
before they are installed in the result map.
traverseWithKey (\k v -> if odd k then Just (succ v) else Nothing) (fromList [(1, 'a'), (5, 'e')]) == Just (fromList [(1, 'b'), (5, 'f')])
traverseWithKey (\k v -> if odd k then Just (succ v) else Nothing) (fromList [(2, 'c')]) == Nothing