[commit: ghc] master: Small local refactoring (448685c)

git at git.haskell.org git at git.haskell.org
Wed Jan 10 08:21:01 UTC 2018


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

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

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

commit 448685c352542155f2e2361776c3b7f5e2a051ca
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Tue Jan 9 16:18:37 2018 +0000

    Small local refactoring


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

448685c352542155f2e2361776c3b7f5e2a051ca
 compiler/typecheck/TcHsType.hs | 37 ++++++++++++-------------------------
 1 file changed, 12 insertions(+), 25 deletions(-)

diff --git a/compiler/typecheck/TcHsType.hs b/compiler/typecheck/TcHsType.hs
index 49d488a..52183a8 100644
--- a/compiler/typecheck/TcHsType.hs
+++ b/compiler/typecheck/TcHsType.hs
@@ -1684,32 +1684,19 @@ tcExplicitTKBndrsX new_tv orig_hs_tvs thing_inside
        ; return (result, bound_tvs `unionVarSet` mkVarSet tvs)
        }
   where
-    go [] thing = thing []
-    go (L _ hs_tv : hs_tvs) thing
-      = do { tv <- tcHsTyVarBndr new_tv hs_tv
-           ; tcExtendTyVarEnv [tv] $
-             go hs_tvs $ \ tvs ->
-             thing (tv : tvs) }
-
-tcHsTyVarBndr :: (Name -> Kind -> TcM TyVar)
-              -> HsTyVarBndr GhcRn -> TcM TcTyVar
--- Return a SkolemTv TcTyVar, initialised with a kind variable.
--- Typically the Kind inside the HsTyVarBndr will be a tyvar
--- with a mutable kind in it.
--- NB: These variables must not be in scope. This function
--- is not appropriate for use with associated types, for example.
---
--- Returned TcTyVar has the same name; no cloning
---
--- See also Note [Associated type tyvar names] in Class
---
-tcHsTyVarBndr new_tv (UserTyVar (L _ name))
-  = do { kind <- newMetaKindVar
-       ; new_tv name kind }
+    go []                   thing = thing []
+    go (L _ hs_tv : hs_tvs) thing = do { tv <- tc_hs_tv hs_tv
+                                       ; tcExtendTyVarEnv [tv] $
+                                         go hs_tvs $ \ tvs ->
+                                         thing (tv : tvs) }
+
+    tc_hs_tv (UserTyVar (L _ name))
+      = do { kind <- newMetaKindVar
+           ; new_tv name kind }
 
-tcHsTyVarBndr new_tv (KindedTyVar (L _ name) kind)
-  = do { kind <- tcLHsKindSig kind
-       ; new_tv name kind }
+    tc_hs_tv  (KindedTyVar (L _ name) kind)
+      = do { kind <- tcLHsKindSig kind
+           ; new_tv name kind }
 
 newWildTyVar :: Name -> TcM TcTyVar
 -- ^ New unification variable for a wildcard



More information about the ghc-commits mailing list