X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2FbasicTypes%2FVarSet.lhs;h=e0ff52d6904c958236a88b9d26b9d6f2e1903ea1;hp=1de03a18610fd067d5287380dc053a1463daab7e;hb=c5b178be60a5a44abd2f4ddf8c399857678326e2;hpb=ad94d40948668032189ad22a0ad741ac1f645f50 diff --git a/compiler/basicTypes/VarSet.lhs b/compiler/basicTypes/VarSet.lhs index 1de03a1..e0ff52d 100644 --- a/compiler/basicTypes/VarSet.lhs +++ b/compiler/basicTypes/VarSet.lhs @@ -4,32 +4,27 @@ % \begin{code} -{-# OPTIONS -w #-} --- The above warning supression flag is a temporary kludge. --- While working on this module you are encouraged to remove it and fix --- any warnings in the module. See --- http://hackage.haskell.org/trac/ghc/wiki/CodingStyle#Warnings --- for details - module VarSet ( - VarSet, IdSet, TyVarSet, + -- * Var, Id and TyVar set types + VarSet, IdSet, TyVarSet, TyCoVarSet, CoVarSet, + + -- ** Manipulating these sets emptyVarSet, unitVarSet, mkVarSet, extendVarSet, extendVarSetList, extendVarSet_C, elemVarSet, varSetElems, subVarSet, unionVarSet, unionVarSets, intersectVarSet, intersectsVarSet, disjointVarSet, isEmptyVarSet, delVarSet, delVarSetList, delVarSetByKey, - minusVarSet, foldVarSet, filterVarSet, + minusVarSet, foldVarSet, filterVarSet, fixVarSet, lookupVarSet, mapVarSet, sizeVarSet, seqVarSet, elemVarSetByKey ) where #include "HsVersions.h" -import Var +import Var ( Var, TyVar, CoVar, TyCoVar, Id ) import Unique import UniqSet -import UniqFM \end{code} %************************************************************************ @@ -42,6 +37,8 @@ import UniqFM type VarSet = UniqSet Var type IdSet = UniqSet Id type TyVarSet = UniqSet TyVar +type TyCoVarSet = UniqSet TyCoVar +type CoVarSet = UniqSet CoVar emptyVarSet :: VarSet intersectVarSet :: VarSet -> VarSet -> VarSet @@ -68,6 +65,7 @@ extendVarSet_C :: (Var->Var->Var) -> VarSet -> Var -> VarSet delVarSetByKey :: VarSet -> Unique -> VarSet elemVarSetByKey :: Unique -> VarSet -> Bool +fixVarSet :: (VarSet -> VarSet) -> VarSet -> VarSet emptyVarSet = emptyUniqSet unitVarSet = unitUniqSet @@ -95,8 +93,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} @@ -105,6 +103,12 @@ elemVarSetByKey = elemUniqSet_Directly intersectsVarSet s1 s2 = not (s1 `disjointVarSet` s2) disjointVarSet s1 s2 = isEmptyVarSet (s1 `intersectVarSet` s2) subVarSet s1 s2 = isEmptyVarSet (s1 `minusVarSet` s2) + +-- Iterate f to a fixpoint +fixVarSet f s | new_s `subVarSet` s = s + | otherwise = fixVarSet f new_s + where + new_s = f s \end{code} \begin{code}