
24 Jan
2012
24 Jan
'12
2:32 p.m.
Milan Straka schrieb:
If others agree, it is indeed simple to generalize type of unionWith[Key] from unionWithKey :: Ord k => (k -> a -> a -> a) -> Map k a -> Map k a -> Map k a to unionWithKey :: Ord k => (k -> a -> a -> Maybe a) -> Map k a -> Map k a -> Map k a These functions are used quite frequently in my opinion, so it will probably result in quite a lot of code breaks (unionWith (++) has to be changed to unionWith (\a b -> Just (a ++ b))).
Just for consistency with other "With" functions, the result of the merger function should be 'a' not 'Maybe a'. Maybe 'unionUpdateWithKey' or so would show the similarity to 'update'.