diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2020-01-16 16:50:59 +0000 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2020-02-06 11:56:02 -0500 |
commit | 7c1228511f2dd4d262c04edb8539174a7de810b2 (patch) | |
tree | 5fbb969c410a4526f0ef77b351d7a1b161c98388 | |
parent | 5541b87c498cdd320e9a18d2134e571d713536e1 (diff) | |
download | haskell-7c1228511f2dd4d262c04edb8539174a7de810b2.tar.gz |
Comments onlywip/T17509
-rw-r--r-- | compiler/types/TyCoFVs.hs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/compiler/types/TyCoFVs.hs b/compiler/types/TyCoFVs.hs index 9b8b5d91a2..2c425d59a2 100644 --- a/compiler/types/TyCoFVs.hs +++ b/compiler/types/TyCoFVs.hs @@ -67,6 +67,31 @@ import Panic %************************************************************************ -} +{- Note [Shallow and deep free variables] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Definitions + +* Shallow free variables of a type: the variables + affected by substitution. Specifically, the (TyVarTy tv) + and (CoVar cv) that appear + - In the type and coercions appearing in the type + - In shallow free variables of the kind of a Forall binder + but NOT in the kind of the /occurrences/ of a type variable. + +* Deep free variables of a type: shallow free variables, plus + the deep free variables of the kinds of those variables. + That is, deepFVs( t ) = closeOverKinds( shallowFVs( t ) ) + +Examples: + + Type Shallow Deep + --------------------------------- + (a : (k:Type)) {a} {a,k} + forall (a:(k:Type)). a {k} {k} + (a:k->Type) (b:k) {a,b} {a,b,k} +-} + + {- Note [Free variables of types] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The family of functions tyCoVarsOfType, tyCoVarsOfTypes etc, returns @@ -247,6 +272,7 @@ noView _ = Nothing {- ********************************************************************* * * Deep free variables + See Note [Shallow and deep free variables] * * ********************************************************************* -} @@ -293,9 +319,11 @@ deepTcvFolder = TyCoFolder { tcf_view = noView {- ********************************************************************* * * Shallow free variables + See Note [Shallow and deep free variables] * * ********************************************************************* -} + shallowTyCoVarsOfType :: Type -> TyCoVarSet -- See Note [Free variables of types] shallowTyCoVarsOfType ty = runTyCoVars (shallow_ty ty) |