Skip to content

Commit d3d9a72

Browse files
authored
difference[With]: Undo constraint relaxation (#573)
... to ensure that we don't break compilation. This reverts commit 304dce1. This reverts commit 6c14fa7.
1 parent 7be935f commit d3d9a72

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

Data/HashMap/Internal.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1838,7 +1838,7 @@ mapKeys f = fromList . foldrWithKey (\k x xs -> (f k, x) : xs) []
18381838

18391839
-- | \(O(n \log m)\) Difference of two maps. Return elements of the first map
18401840
-- not existing in the second.
1841-
difference :: Eq k => HashMap k v -> HashMap k w -> HashMap k v
1841+
difference :: Hashable k => HashMap k v -> HashMap k w -> HashMap k v
18421842
difference = go_difference 0
18431843
where
18441844
go_difference !_s Empty _ = Empty
@@ -1964,7 +1964,7 @@ differenceCollisions !h1 !ary1 t1 !h2 !ary2
19641964
-- encountered, the combining function is applied to the values of these keys.
19651965
-- If it returns 'Nothing', the element is discarded (proper set difference). If
19661966
-- it returns (@'Just' y@), the element is updated with a new value @y@.
1967-
differenceWith :: Eq k => (v -> w -> Maybe v) -> HashMap k v -> HashMap k w -> HashMap k v
1967+
differenceWith :: Hashable k => (v -> w -> Maybe v) -> HashMap k v -> HashMap k w -> HashMap k v
19681968
differenceWith f = differenceWithKey (const f)
19691969
{-# INLINE differenceWith #-}
19701970

Data/HashMap/Internal/Strict.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ traverseWithKey f = go
621621
-- encountered, the combining function is applied to the values of these keys.
622622
-- If it returns 'Nothing', the element is discarded (proper set difference). If
623623
-- it returns (@'Just' y@), the element is updated with a new value @y@.
624-
differenceWith :: Eq k => (v -> w -> Maybe v) -> HashMap k v -> HashMap k w -> HashMap k v
624+
differenceWith :: Hashable k => (v -> w -> Maybe v) -> HashMap k v -> HashMap k w -> HashMap k v
625625
differenceWith f = HM.differenceWithKey $
626626
\_k vA vB -> case f vA vB of
627627
Nothing -> Nothing

Data/HashSet/Internal.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ map f = fromList . List.map f . toList
392392
--
393393
-- >>> HashSet.difference (HashSet.fromList [1,2,3]) (HashSet.fromList [2,3,4])
394394
-- fromList [1]
395-
difference :: Eq a => HashSet a -> HashSet a -> HashSet a
395+
difference :: Hashable a => HashSet a -> HashSet a -> HashSet a
396396
difference (HashSet a) (HashSet b) = HashSet (H.difference a b)
397397
{-# INLINABLE difference #-}
398398

0 commit comments

Comments
 (0)