X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;ds=sidebyside;f=compiler%2FbasicTypes%2FVarSet.lhs;fp=compiler%2FbasicTypes%2FVarSet.lhs;h=6f03aad1bf05c1ce4c051fee1688969a98d166e5;hb=e5a8d57c85d42007c8cc561e6d6b805c23603fc0;hp=67a3dbf4c2eb3d08c62dde6ffa187b53fb1d3a85;hpb=902b277cd6ae9a37f84967cdec6335af4c29575e;p=ghc-hetmet.git diff --git a/compiler/basicTypes/VarSet.lhs b/compiler/basicTypes/VarSet.lhs index 67a3dbf..6f03aad 100644 --- a/compiler/basicTypes/VarSet.lhs +++ b/compiler/basicTypes/VarSet.lhs @@ -15,7 +15,7 @@ module VarSet ( unionVarSet, unionVarSets, intersectVarSet, intersectsVarSet, disjointVarSet, isEmptyVarSet, delVarSet, delVarSetList, delVarSetByKey, - minusVarSet, foldVarSet, filterVarSet, + minusVarSet, foldVarSet, filterVarSet, fixVarSet, lookupVarSet, mapVarSet, sizeVarSet, seqVarSet, elemVarSetByKey ) where @@ -63,6 +63,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 +101,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}