[commit: ghc] wip/T14880-just-tvs: Rewrite tyCoVarsOfType in terms of TypeSet (0ac162f)

git at git.haskell.org git at git.haskell.org
Thu Aug 2 09:05:23 UTC 2018


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

On branch  : wip/T14880-just-tvs
Link       : http://ghc.haskell.org/trac/ghc/changeset/0ac162f81646b9db3ae99f9868e10c10bf0fe9bc/ghc

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

commit 0ac162f81646b9db3ae99f9868e10c10bf0fe9bc
Author: Tobias Dammers <tdammers at gmail.com>
Date:   Tue Jul 31 22:32:34 2018 +0200

    Rewrite tyCoVarsOfType in terms of TypeSet


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

0ac162f81646b9db3ae99f9868e10c10bf0fe9bc
 compiler/types/TyCoRep.hs | 15 ++++++++++++++-
 utils/haddock             |  2 +-
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/compiler/types/TyCoRep.hs b/compiler/types/TyCoRep.hs
index ec4607a..2fdf172 100644
--- a/compiler/types/TyCoRep.hs
+++ b/compiler/types/TyCoRep.hs
@@ -1484,7 +1484,15 @@ so, so it's easiest to do it here.
 -- synonym.
 tyCoVarsOfType :: Type -> TyCoVarSet
 -- See Note [Free variables of types]
-tyCoVarsOfType ty = fvVarSet $ tyCoFVsOfType ty
+-- tyCoVarsOfType ty = fvVarSet $ tyCoFVsOfType ty
+tyCoVarsOfType (TyVarTy v)        = extendVarSet (tyCoVarsOfType (tyVarKind v)) v
+tyCoVarsOfType (TyConApp _ tys)   = tyCoVarsOfTypes tys
+tyCoVarsOfType (LitTy {})         = emptyVarSet
+tyCoVarsOfType (AppTy fun arg)    = (tyCoVarsOfType fun `unionVarSet` tyCoVarsOfType arg)
+tyCoVarsOfType (FunTy arg res)    = (tyCoVarsOfType arg `unionVarSet` tyCoVarsOfType res)
+tyCoVarsOfType (ForAllTy bndr ty) = tyCoVarSetsBndr bndr (tyCoVarsOfType ty)
+tyCoVarsOfType (CastTy ty co)     = (tyCoVarsOfType ty `unionVarSet` tyCoVarsOfCo co)
+tyCoVarsOfType (CoercionTy co)    = tyCoVarsOfCo co
 
 -- | `tyCoFVsOfType` that returns free variables of a type in a deterministic
 -- set. For explanation of why using `VarSet` is not deterministic see
@@ -1493,6 +1501,11 @@ tyCoVarsOfTypeDSet :: Type -> DTyCoVarSet
 -- See Note [Free variables of types]
 tyCoVarsOfTypeDSet ty = fvDVarSet $ tyCoFVsOfType ty
 
+tyCoVarSetsBndr :: TyVarBinder -> VarSet -> VarSet
+-- Free vars of (forall b. <thing with fvs>)
+tyCoVarSetsBndr (TvBndr tv _) fvs = (delVarSet fvs tv)
+                                `unionVarSet` tyCoVarsOfType (tyVarKind tv)
+
 -- | `tyCoFVsOfType` that returns free variables of a type in deterministic
 -- order. For explanation of why using `VarSet` is not deterministic see
 -- Note [Deterministic FV] in FV.
diff --git a/utils/haddock b/utils/haddock
index 0d903e5..76d0f9b 160000
--- a/utils/haddock
+++ b/utils/haddock
@@ -1 +1 @@
-Subproject commit 0d903e5e7ea877cbf6e8a7a84c9c8b6ef8c78ef6
+Subproject commit 76d0f9b90a7b2f65ae12e1ce5dd0552909493252



More information about the ghc-commits mailing list