Be a bit more consistent about what's a set and what's a map
authorIan Lynagh <igloo@earth.li>
Tue, 5 Feb 2008 21:19:09 +0000 (21:19 +0000)
committerIan Lynagh <igloo@earth.li>
Tue, 5 Feb 2008 21:19:09 +0000 (21:19 +0000)
compiler/basicTypes/OccName.lhs
compiler/basicTypes/VarSet.lhs
compiler/utils/UniqSet.lhs

index 97d6857..c96cfd2 100644 (file)
@@ -302,7 +302,7 @@ filterOccEnv x (A y)       = A $ filterUFM x y
 instance Outputable a => Outputable (OccEnv a) where
     ppr (A x) = ppr x
 
-type OccSet = UniqFM OccName
+type OccSet = UniqSet OccName
 
 emptyOccSet      :: OccSet
 unitOccSet       :: OccName -> OccSet
index 3c61225..1bef89a 100644 (file)
@@ -95,8 +95,8 @@ lookupVarSet  = lookupUniqSet
 mapVarSet      = mapUniqSet
 sizeVarSet     = sizeUniqSet
 filterVarSet   = filterUniqSet
-extendVarSet_C combine s x = addToUFM_C combine s x x
-delVarSetByKey = delFromUFM_Directly   -- Can't be bothered to add this to UniqSet
+extendVarSet_C = addOneToUniqSet_C
+delVarSetByKey = delOneFromUniqSet_Directly
 elemVarSetByKey        = elemUniqSet_Directly
 \end{code}
 
index ba312dd..90e0c9f 100644 (file)
@@ -13,8 +13,8 @@ module UniqSet (
         UniqSet,    -- abstract type: NOT
 
         mkUniqSet, uniqSetToList, emptyUniqSet, unitUniqSet,
-        addOneToUniqSet, addListToUniqSet,
-        delOneFromUniqSet, delListFromUniqSet,
+        addOneToUniqSet, addListToUniqSet, addOneToUniqSet_C,
+        delOneFromUniqSet, delListFromUniqSet, delOneFromUniqSet_Directly,
         unionUniqSets, unionManyUniqSets, minusUniqSet,
         elementOfUniqSet, mapUniqSet, intersectUniqSets,
         isEmptyUniqSet, filterUniqSet, sizeUniqSet, foldUniqSet,
@@ -65,9 +65,17 @@ mkUniqSet xs = MkUniqSet (listToUFM [ (x, x) | x <- xs])
 addOneToUniqSet :: Uniquable a => UniqSet a -> a -> UniqSet a
 addOneToUniqSet (MkUniqSet set) x = MkUniqSet (addToUFM set x x)
 
+addOneToUniqSet_C :: Uniquable a
+                  => (a -> a -> a) -> UniqSet a -> a -> UniqSet a
+addOneToUniqSet_C f (MkUniqSet set) x = MkUniqSet (addToUFM_C f set x x)
+
 delOneFromUniqSet :: Uniquable a => UniqSet a -> a -> UniqSet a
 delOneFromUniqSet (MkUniqSet set) x = MkUniqSet (delFromUFM set x)
 
+delOneFromUniqSet_Directly :: Uniquable a => UniqSet a -> Unique -> UniqSet a
+delOneFromUniqSet_Directly (MkUniqSet set) u
+    = MkUniqSet (delFromUFM_Directly set u)
+
 delListFromUniqSet :: Uniquable a => UniqSet a -> [a] -> UniqSet a
 delListFromUniqSet (MkUniqSet set) xs = MkUniqSet (delListFromUFM set xs)