From: ross Date: Tue, 18 Jan 2005 11:23:35 +0000 (+0000) Subject: [project @ 2005-01-18 11:23:35 by ross] X-Git-Tag: nhc98-1-18-release~102 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=28effeb33421aaf0f160073d36ef7da7570ed169;p=ghc-base.git [project @ 2005-01-18 11:23:35 by ross] generalize the types of intersectionWith and intersectionWithKey --- diff --git a/Data/Map.hs b/Data/Map.hs index b23880a..4635bf4 100644 --- a/Data/Map.hs +++ b/Data/Map.hs @@ -625,13 +625,13 @@ intersection m1 m2 = intersectionWithKey (\k x y -> x) m1 m2 -- | /O(n+m)/. Intersection with a combining function. -intersectionWith :: Ord k => (a -> b -> a) -> Map k a -> Map k b -> Map k a +intersectionWith :: Ord k => (a -> b -> c) -> Map k a -> Map k b -> Map k c intersectionWith f m1 m2 = intersectionWithKey (\k x y -> f x y) m1 m2 -- | /O(n+m)/. Intersection with a combining function. -- Intersection is more efficient on (bigset `intersection` smallset) -intersectionWithKey :: Ord k => (k -> a -> b -> a) -> Map k a -> Map k b -> Map k a +intersectionWithKey :: Ord k => (k -> a -> b -> c) -> Map k a -> Map k b -> Map k c intersectionWithKey f Tip t = Tip intersectionWithKey f t Tip = Tip intersectionWithKey f t1 t2