summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2017-10-06 17:16:50 -0400
committerBen Gamari <ben@smart-cactus.org>2017-10-06 17:16:50 -0400
commit5abaa92b73046bddcb7ef83f09704cc3c6dd13f7 (patch)
treee9892e8c66ee10e3eacafe8735d6f3b40e7e2556
parentd475343c9edec655a814746fb253d6805138f5b0 (diff)
downloadhaskell-wip/T12919.tar.gz
Second optimizationwip/T12919
-rw-r--r--compiler/typecheck/TcFlatten.hs6
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/typecheck/TcFlatten.hs b/compiler/typecheck/TcFlatten.hs
index 6730d0b8fd..3e7b998bbc 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