[commit: ghc] wip/T12919: Second optimization (5abaa92)

git at git.haskell.org git at git.haskell.org
Mon Dec 18 17:27:36 UTC 2017


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

On branch  : wip/T12919
Link       : http://ghc.haskell.org/trac/ghc/changeset/5abaa92b73046bddcb7ef83f09704cc3c6dd13f7/ghc

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

commit 5abaa92b73046bddcb7ef83f09704cc3c6dd13f7
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Fri Oct 6 17:16:50 2017 -0400

    Second optimization


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

5abaa92b73046bddcb7ef83f09704cc3c6dd13f7
 compiler/typecheck/TcFlatten.hs | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/compiler/typecheck/TcFlatten.hs b/compiler/typecheck/TcFlatten.hs
index 6730d0b..3e7b998 100644
--- a/compiler/typecheck/TcFlatten.hs
+++ b/compiler/typecheck/TcFlatten.hs
@@ -1183,6 +1183,7 @@ flatten_args orig_binders orig_inner_ki orig_fvs orig_roles orig_tys
                                             ppr orig_tys])
 
 flatten_args orig_binders orig_inner_ki orig_fvs orig_roles orig_tys
+    -- Slow path: 
   = go [] [] orig_lc orig_binders orig_inner_ki orig_roles orig_tys
   where
     orig_lc = emptyLiftingContext $ mkInScopeSet $ orig_fvs
@@ -1200,7 +1201,10 @@ flatten_args orig_binders orig_inner_ki orig_fvs orig_roles orig_tys
       = return (reverse acc_xis, reverse acc_cos, kind_co)
       where
         final_kind = mkPiTys binders inner_ki
-        kind_co    = liftCoSubst Nominal lc final_kind
+        kind_co
+            -- liftCoSubst only necessary if kind has free variables
+          | isEmptyVarSet orig_fvs = mkReflCo Nominal final_kind
+          | otherwise              = liftCoSubst Nominal lc final_kind
 
     go acc_xis acc_cos lc (binder:binders) inner_ki (role:roles) (ty:tys)
       = do { (xi, co) <- case role of



More information about the ghc-commits mailing list