X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2FbasicTypes%2FVarSet.lhs;h=e0ff52d6904c958236a88b9d26b9d6f2e1903ea1;hp=67a3dbf4c2eb3d08c62dde6ffa187b53fb1d3a85;hb=HEAD;hpb=6084fb5517da34f65034370a3695e2af3b85ce2b diff --git a/compiler/basicTypes/VarSet.lhs b/compiler/basicTypes/VarSet.lhs index 67a3dbf..e0ff52d 100644 --- a/compiler/basicTypes/VarSet.lhs +++ b/compiler/basicTypes/VarSet.lhs @@ -6,7 +6,7 @@ \begin{code} module VarSet ( -- * Var, Id and TyVar set types - VarSet, IdSet, TyVarSet, + VarSet, IdSet, TyVarSet, TyCoVarSet, CoVarSet, -- ** Manipulating these sets emptyVarSet, unitVarSet, mkVarSet, @@ -15,14 +15,14 @@ module VarSet ( 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 ( Var, TyVar, Id ) +import Var ( Var, TyVar, CoVar, TyCoVar, Id ) import Unique import UniqSet \end{code} @@ -37,6 +37,8 @@ import UniqSet 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 @@ -63,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 @@ -100,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}