[commit: ghc] wip/T15050: Turn the comment next to SigTv into a proper Note (256d523)

git at git.haskell.org git at git.haskell.org
Sat Aug 4 16:55:42 UTC 2018


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

On branch  : wip/T15050
Link       : http://ghc.haskell.org/trac/ghc/changeset/256d5237764491cb1740aca5db1b70adaa5c5e18/ghc

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

commit 256d5237764491cb1740aca5db1b70adaa5c5e18
Author: Joachim Breitner <mail at joachim-breitner.de>
Date:   Sat Aug 4 12:43:22 2018 -0400

    Turn the comment next to SigTv into a proper Note


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

256d5237764491cb1740aca5db1b70adaa5c5e18
 compiler/typecheck/TcHsType.hs |  2 +-
 compiler/typecheck/TcMType.hs  | 44 ++++++++++++++++++++++++++++--------------
 2 files changed, 31 insertions(+), 15 deletions(-)

diff --git a/compiler/typecheck/TcHsType.hs b/compiler/typecheck/TcHsType.hs
index 5fceee9..4855d61 100644
--- a/compiler/typecheck/TcHsType.hs
+++ b/compiler/typecheck/TcHsType.hs
@@ -1572,7 +1572,7 @@ kcLHsQTyVars name flav cusk
   | otherwise
   = do { (scoped_kvs, (tc_tvs, res_kind))
            -- Why kcImplicitTKBndrs which uses newSigTyVar?
-           -- See Note [Kind generalisation and sigTvs]
+           -- See Note [Kind generalisation and SigTvs]
            <- kcImplicitTKBndrs kv_ns $
               kcLHsQTyVarBndrs cusk open_fam skol_info hs_tvs thing_inside
 
diff --git a/compiler/typecheck/TcMType.hs b/compiler/typecheck/TcMType.hs
index 3e77e43..a44b5e0 100644
--- a/compiler/typecheck/TcMType.hs
+++ b/compiler/typecheck/TcMType.hs
@@ -620,13 +620,28 @@ instead of the buggous
 ************************************************************************
 -}
 
--- a SigTv can unify with type *variables* only, including other SigTvs
--- and skolems. Sometimes, they can unify with type variables that the
--- user would rather keep distinct; see #11203 for an example.
--- So, any client of this
--- function needs to either allow the SigTvs to unify with each other
--- (say, for pattern-bound scoped type variables), or check that they
--- don't (say, with a call to findDubSigTvs).
+{-
+Note [SigTv]
+~~~~~~~~~~~~
+
+A SigTv can unify with type *variables* only, including other SigTvs and
+skolems. Sometimes, they can unify with type variables that the user would
+rather keep distinct; see #11203 for an example.  So, any client of this
+function needs to either allow the SigTvs to unify with each other or check
+that they don't (say, with a call to findDubSigTvs).
+
+Before #15050 this was used for ScopedTypeVariables in patterns, to make sure
+these type variables only refer to other type variables, but this restriction
+was dropped, and ScopedTypeVariables can now refer to full types (GHC Proposal
+29).
+
+The remaining uses of newSigTyVars are
+* in kind signatures, see Note [Kind generalisation and SigTvs]
+  and Note [Use SigTvs in kind-checking pass]
+* in partial type signatures, see Note [Quantified variables in partial type signatures]
+-}
+
+-- see Note [SigTv]
 newSigTyVar :: Name -> Kind -> TcM TcTyVar
 newSigTyVar name kind
   = do { details <- newMetaDetails SigTv
@@ -634,13 +649,6 @@ newSigTyVar name kind
        ; traceTc "newSigTyVar" (ppr tyvar)
        ; return tyvar }
 
-newTauTyVar :: Name -> Kind -> TcM TcTyVar
-newTauTyVar name kind
-  = do { details <- newMetaDetails TauTv
-       ; let tyvar = mkTcTyVar name kind details
-       ; traceTc "newTauTyVar" (ppr tyvar)
-       ; return tyvar }
-
 
 -- makes a new skolem tv
 newSkolemTyVar :: Name -> Kind -> TcM TcTyVar
@@ -815,6 +823,14 @@ coercion variables, except for the special case of the promoted Eq#. But,
 that can't ever appear in user code, so we're safe!
 -}
 
+newTauTyVar :: Name -> Kind -> TcM TcTyVar
+newTauTyVar name kind
+  = do { details <- newMetaDetails TauTv
+       ; let tyvar = mkTcTyVar name kind details
+       ; traceTc "newTauTyVar" (ppr tyvar)
+       ; return tyvar }
+
+
 mkMetaTyVarName :: Unique -> FastString -> Name
 -- Makes a /System/ Name, which is eagerly eliminated by
 -- the unifier; see TcUnify.nicer_to_update_tv1, and



More information about the ghc-commits mailing list