summaryrefslogtreecommitdiff
path: root/compiler/GHC/Tc/Gen/Expr.hs-boot
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2020-04-08 23:08:12 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2020-04-21 14:38:26 +0100
commit11e69aaa8b55322b1aa9edba8c2ea17441b9f3c3 (patch)
tree04bdcf4a51812193a0666551afc455d528a02971 /compiler/GHC/Tc/Gen/Expr.hs-boot
parent747093b7c23a1cf92b564eb3d9efe2adc15330df (diff)
downloadhaskell-wip/T17173.tar.gz
Do eager instantation in termswip/T17173
This patch implements eager instantiation, a small but critical change to the type inference engine, #17173. The main change is this: When inferring types, always return an instantiated type (for now, deeply instantiated; in future shallowly instantiated) There is more discussion in https://www.tweag.io/posts/2020-04-02-lazy-eager-instantiation.html There is quite a bit of refactoring in this patch: * The ir_inst field of GHC.Tc.Utils.TcType.InferResultk has entirely gone. So tcInferInst and tcInferNoInst have collapsed into tcInfer. * Type inference of applications, via tcInferApp and tcInferAppHead, are substantially refactored, preparing the way for Quick Look impredicativity. * New pure function GHC.Tc.Gen.Expr.collectHsArgs and applyHsArgs are beatifully dual. We can see the zipper! * GHC.Tc.Gen.Expr.tcArgs is now much nicer; no longer needs to return a wrapper * In HsExpr, HsTypeApp now contains the the actual type argument, and is used in desugaring, rather than putting it in a mysterious wrapper. * I struggled a bit with good error reporting in Unify.matchActualFunTysPart. It's a little bit simpler than before, but still not great. Some smaller things * Rename tcPolyExpr --> tcCheckExpr tcMonoExpr --> tcLExpr * tcPatSig moves from GHC.Tc.Gen.HsType to GHC.Tc.Gen.Pat Metric Decrease: T9961 Reduction of 1.6% in comiler allocation on T9961, I think.
Diffstat (limited to 'compiler/GHC/Tc/Gen/Expr.hs-boot')
-rw-r--r--compiler/GHC/Tc/Gen/Expr.hs-boot27
1 files changed, 10 insertions, 17 deletions
diff --git a/compiler/GHC/Tc/Gen/Expr.hs-boot b/compiler/GHC/Tc/Gen/Expr.hs-boot
index 27ebefc9a3..d9138a4d7e 100644
--- a/compiler/GHC/Tc/Gen/Expr.hs-boot
+++ b/compiler/GHC/Tc/Gen/Expr.hs-boot
@@ -6,23 +6,16 @@ import GHC.Tc.Types ( TcM )
import GHC.Tc.Types.Origin ( CtOrigin )
import GHC.Hs.Extension ( GhcRn, GhcTcId )
-tcPolyExpr ::
- LHsExpr GhcRn
- -> TcSigmaType
- -> TcM (LHsExpr GhcTcId)
-
-tcMonoExpr, tcMonoExprNC ::
- LHsExpr GhcRn
- -> ExpRhoType
- -> TcM (LHsExpr GhcTcId)
-
-tcInferSigma ::
- LHsExpr GhcRn
- -> TcM (LHsExpr GhcTcId, TcSigmaType)
-
-tcInferRho, tcInferRhoNC ::
- LHsExpr GhcRn
- -> TcM (LHsExpr GhcTcId, TcRhoType)
+tcCheckExpr :: LHsExpr GhcRn -> TcSigmaType -> TcM (LHsExpr GhcTcId)
+
+tcLExpr, tcLExprNC
+ :: LHsExpr GhcRn -> ExpRhoType -> TcM (LHsExpr GhcTcId)
+tcExpr :: HsExpr GhcRn -> ExpRhoType -> TcM (HsExpr GhcTcId)
+
+tcInferRho, tcInferRhoNC
+ :: LHsExpr GhcRn-> TcM (LHsExpr GhcTcId, TcRhoType)
+
+tcInferSigma :: LHsExpr GhcRn-> TcM (LHsExpr GhcTcId, TcSigmaType)
tcSyntaxOp :: CtOrigin
-> SyntaxExprRn