[commit: ghc] wip/T15050: Use TauTv for pattern signature variables #15050 (2be9001)

git at git.haskell.org git at git.haskell.org
Mon Apr 23 17:34:45 UTC 2018


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

On branch  : wip/T15050
Link       : http://ghc.haskell.org/trac/ghc/changeset/2be900108ed862d090bb7475aeb48a9a273e81fb/ghc

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

commit 2be900108ed862d090bb7475aeb48a9a273e81fb
Author: Joachim Breitner <mail at joachim-breitner.de>
Date:   Mon Apr 23 13:13:37 2018 -0400

    Use TauTv for pattern signature variables #15050
    
    just to see what happens.
    
    This commit does not yet
     * update all the notes
     * rename `SigTv` to `TauTv`, as it should:
       Originally, `SigTv` was only used in pattern signatures (and a note
       still claims that). But then it seems that the same behaviour is also
       needed for kind variables. So this patch tries to not touch the
       effect on kind variables, but it would be odd to continue to call
       them `PatTv`.
    
    These things will be done once we decide we actually want this feature.


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

2be900108ed862d090bb7475aeb48a9a273e81fb
 compiler/typecheck/TcHsType.hs | 14 +++-----------
 compiler/typecheck/TcMType.hs  | 10 +++++++++-
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/compiler/typecheck/TcHsType.hs b/compiler/typecheck/TcHsType.hs
index 6874a74..6974d54 100644
--- a/compiler/typecheck/TcHsType.hs
+++ b/compiler/typecheck/TcHsType.hs
@@ -18,8 +18,8 @@ module TcHsType (
         tcHsDeriv, tcHsVectInst,
         tcHsTypeApp,
         UserTypeCtxt(..),
-        tcImplicitTKBndrs, tcImplicitTKBndrsX, tcImplicitTKBndrsSig,
-        tcExplicitTKBndrs, tcExplicitTKBndrsX, tcExplicitTKBndrsSig,
+        tcImplicitTKBndrs, tcImplicitTKBndrsX,
+        tcExplicitTKBndrs, tcExplicitTKBndrsX,
         kcExplicitTKBndrs, kcImplicitTKBndrs,
 
                 -- Type checking type and class decls
@@ -1806,14 +1806,6 @@ tcExplicitTKBndrs :: SkolemInfo
 -- No cloning: returned TyVars have the same Name as the incoming LHsTyVarBndrs
 tcExplicitTKBndrs = tcExplicitTKBndrsX newSkolemTyVar
 
--- | This brings a bunch of tyvars into scope as SigTvs, where they can unify
--- with other type *variables* only.
-tcExplicitTKBndrsSig :: SkolemInfo
-                     -> [LHsTyVarBndr GhcRn]
-                     -> TcM a
-                     -> TcM ([TcTyVar], a)
-tcExplicitTKBndrsSig = tcExplicitTKBndrsX newSigTyVar
-
 tcExplicitTKBndrsX :: (Name -> Kind -> TcM TyVar)
                    -> SkolemInfo
                    -> [LHsTyVarBndr GhcRn]
@@ -2470,7 +2462,7 @@ tcHsPatSigType ctxt sig_ty
 
     new_tv = case ctxt of
                RuleSigCtxt {} -> newSkolemTyVar
-               _              -> newSigTyVar
+               _              -> newTauTyVar
       -- See Note [Pattern signature binders]
       -- See Note [Unifying SigTvs]
 
diff --git a/compiler/typecheck/TcMType.hs b/compiler/typecheck/TcMType.hs
index b1bc1d0..e493715 100644
--- a/compiler/typecheck/TcMType.hs
+++ b/compiler/typecheck/TcMType.hs
@@ -55,7 +55,7 @@ module TcMType (
   -- Instantiation
   newMetaTyVars, newMetaTyVarX, newMetaTyVarsX,
   newMetaSigTyVars, newMetaSigTyVarX,
-  newSigTyVar, newSkolemTyVar, newWildCardX,
+  newSigTyVar, newTauTyVar, newSkolemTyVar, newWildCardX,
   tcInstType,
   tcInstSkolTyVars,tcInstSkolTyVarsX,
   tcInstSuperSkolTyVarsX,
@@ -613,6 +613,14 @@ 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
 newSkolemTyVar name kind = do { lvl <- getTcLevel



More information about the ghc-commits mailing list