From 731292317a928e397478377d4273f22213658cbe Mon Sep 17 00:00:00 2001 From: Bartosz Nitka Date: Thu, 28 Apr 2016 13:35:14 -0700 Subject: Kill mapUniqSet Note [Unsound mapUniqSet] explains why it got removed. Test Plan: build ghc Reviewers: simonpj, austin, bgamari Reviewed By: bgamari Subscribers: thomie, simonmar Differential Revision: https://phabricator.haskell.org/D2152 --- compiler/utils/UniqSet.hs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'compiler/utils/UniqSet.hs') diff --git a/compiler/utils/UniqSet.hs b/compiler/utils/UniqSet.hs index c1d19b3695..a316f53370 100644 --- a/compiler/utils/UniqSet.hs +++ b/compiler/utils/UniqSet.hs @@ -23,7 +23,6 @@ module UniqSet ( minusUniqSet, intersectUniqSets, foldUniqSet, uniqSetAny, uniqSetAll, - mapUniqSet, elementOfUniqSet, elemUniqSet_Directly, filterUniqSet, @@ -63,7 +62,6 @@ minusUniqSet :: UniqSet a -> UniqSet a -> UniqSet a intersectUniqSets :: UniqSet a -> UniqSet a -> UniqSet a foldUniqSet :: (a -> b -> b) -> b -> UniqSet a -> b -mapUniqSet :: (a -> b) -> UniqSet a -> UniqSet b elementOfUniqSet :: Uniquable a => a -> UniqSet a -> Bool elemUniqSet_Directly :: Unique -> UniqSet a -> Bool filterUniqSet :: (a -> Bool) -> UniqSet a -> UniqSet a @@ -82,6 +80,15 @@ uniqSetToList :: UniqSet a -> [a] ************************************************************************ -} +-- Note [Unsound mapUniqSet] +-- ~~~~~~~~~~~~~~~~~~~~~~~~~ +-- UniqSet has the following invariant: +-- The keys in the map are the uniques of the values +-- It means that to implement mapUniqSet you'd have to update +-- both the keys and the values. There used to be an implementation +-- that only updated the values and it's been removed, because it broke +-- the invariant. + type UniqSet a = UniqFM a emptyUniqSet = emptyUFM @@ -103,7 +110,6 @@ minusUniqSet = minusUFM intersectUniqSets = intersectUFM foldUniqSet = foldUFM -mapUniqSet = mapUFM elementOfUniqSet = elemUFM elemUniqSet_Directly = elemUFM_Directly filterUniqSet = filterUFM -- cgit v1.2.1