[commit: ghc] master: Add VarSet.anyDVarSet, allDVarSet (cdf6b69)

git at git.haskell.org git at git.haskell.org
Wed Mar 1 01:17:27 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/cdf6b69563f66b3ef26481003654d645466e5450/ghc

>---------------------------------------------------------------

commit cdf6b69563f66b3ef26481003654d645466e5450
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Tue Feb 28 20:17:10 2017 -0500

    Add VarSet.anyDVarSet, allDVarSet
    
    I need these in a later commit.
    
    Also rename
      varSetAny  -->  anyVarSet
      varSetAll  -->  allVarSet
    for consistency with other functions; eg filterVarSet
    
    Reviewers: austin, goldfire, bgamari
    
    Subscribers: niteria, thomie
    
    Differential Revision: https://phabricator.haskell.org/D3202


>---------------------------------------------------------------

cdf6b69563f66b3ef26481003654d645466e5450
 compiler/basicTypes/VarSet.hs | 20 +++++++++++++-------
 compiler/specialise/Rules.hs  |  2 +-
 compiler/typecheck/TcType.hs  |  2 +-
 compiler/types/Unify.hs       |  4 ++--
 4 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/compiler/basicTypes/VarSet.hs b/compiler/basicTypes/VarSet.hs
index a6e508a..f6d82fd 100644
--- a/compiler/basicTypes/VarSet.hs
+++ b/compiler/basicTypes/VarSet.hs
@@ -17,7 +17,7 @@ module VarSet (
         intersectVarSet, intersectsVarSet, disjointVarSet,
         isEmptyVarSet, delVarSet, delVarSetList, delVarSetByKey,
         minusVarSet, filterVarSet,
-        varSetAny, varSetAll,
+        anyVarSet, allVarSet,
         transCloVarSet, fixVarSet,
         lookupVarSet, lookupVarSetByName,
         sizeVarSet, seqVarSet,
@@ -35,7 +35,7 @@ module VarSet (
         intersectDVarSet, intersectsDVarSet, disjointDVarSet,
         isEmptyDVarSet, delDVarSet, delDVarSetList,
         minusDVarSet, foldDVarSet, filterDVarSet,
-        dVarSetMinusVarSet,
+        dVarSetMinusVarSet, anyDVarSet, allDVarSet,
         transCloDVarSet,
         sizeDVarSet, seqDVarSet,
         partitionDVarSet,
@@ -50,7 +50,7 @@ import Name     ( Name )
 import UniqSet
 import UniqDSet
 import UniqFM( disjointUFM, pluralUFM, pprUFM )
-import UniqDFM( disjointUDFM, udfmToUfm )
+import UniqDFM( disjointUDFM, udfmToUfm, anyUDFM, allUDFM )
 import Outputable (SDoc)
 
 -- | A non-deterministic Variable Set
@@ -139,11 +139,11 @@ intersectsVarSet s1 s2 = not (s1 `disjointVarSet` s2)
 disjointVarSet   s1 s2 = disjointUFM s1 s2
 subVarSet        s1 s2 = isEmptyVarSet (s1 `minusVarSet` s2)
 
-varSetAny :: (Var -> Bool) -> VarSet -> Bool
-varSetAny = uniqSetAny
+anyVarSet :: (Var -> Bool) -> VarSet -> Bool
+anyVarSet = uniqSetAny
 
-varSetAll :: (Var -> Bool) -> VarSet -> Bool
-varSetAll = uniqSetAll
+allVarSet :: (Var -> Bool) -> VarSet -> Bool
+allVarSet = uniqSetAll
 
 -- There used to exist mapVarSet, see Note [Unsound mapUniqSet] in UniqSet for
 -- why it got removed.
@@ -282,6 +282,12 @@ dVarSetMinusVarSet = uniqDSetMinusUniqSet
 foldDVarSet :: (Var -> a -> a) -> a -> DVarSet -> a
 foldDVarSet = foldUniqDSet
 
+anyDVarSet :: (Var -> Bool) -> DVarSet -> Bool
+anyDVarSet = anyUDFM
+
+allDVarSet :: (Var -> Bool) -> DVarSet -> Bool
+allDVarSet = allUDFM
+
 filterDVarSet :: (Var -> Bool) -> DVarSet -> DVarSet
 filterDVarSet = filterUniqDSet
 
diff --git a/compiler/specialise/Rules.hs b/compiler/specialise/Rules.hs
index 2ad4e1c..47193c6 100644
--- a/compiler/specialise/Rules.hs
+++ b/compiler/specialise/Rules.hs
@@ -864,7 +864,7 @@ match_alts _ _ _ _
 ------------------------------------------
 okToFloat :: RnEnv2 -> VarSet -> Bool
 okToFloat rn_env bind_fvs
-  = varSetAll not_captured bind_fvs
+  = allVarSet not_captured bind_fvs
   where
     not_captured fv = not (inRnEnvR rn_env fv)
 
diff --git a/compiler/typecheck/TcType.hs b/compiler/typecheck/TcType.hs
index 7e5c0b0..69d1f7c 100644
--- a/compiler/typecheck/TcType.hs
+++ b/compiler/typecheck/TcType.hs
@@ -911,7 +911,7 @@ anyRewritableTyVar ignore_cos pred ty
 
     go_co bound co
       | ignore_cos = False
-      | otherwise  = varSetAny (go_tv bound) (tyCoVarsOfCo co)
+      | otherwise  = anyVarSet (go_tv bound) (tyCoVarsOfCo co)
       -- We don't have an equivalent of anyRewritableTyVar for coercions
       -- (at least not yet) so take the free vars and test them
 
diff --git a/compiler/types/Unify.hs b/compiler/types/Unify.hs
index ed879eb..517358d 100644
--- a/compiler/types/Unify.hs
+++ b/compiler/types/Unify.hs
@@ -522,7 +522,7 @@ niFixTCvSubst tenv = f tenv
         | not_fixpoint = f (mapVarEnv (substTy subst') tenv)
         | otherwise    = subst
         where
-          not_fixpoint  = varSetAny in_domain range_tvs
+          not_fixpoint  = anyVarSet in_domain range_tvs
           in_domain tv  = tv `elemVarEnv` tenv
 
           range_tvs     = nonDetFoldUFM (unionVarSet . tyCoVarsOfType) emptyVarSet tenv
@@ -1223,7 +1223,7 @@ ty_co_match menv subst ty co lkco rkco
       = noneSet (\v -> elemVarEnv v env) set
 
     noneSet :: (Var -> Bool) -> VarSet -> Bool
-    noneSet f = varSetAll (not . f)
+    noneSet f = allVarSet (not . f)
 
 ty_co_match menv subst ty co lkco rkco
   | CastTy ty' co' <- ty



More information about the ghc-commits mailing list