summaryrefslogtreecommitdiff
path: root/compiler/GHC/Tc/Solver.hs
diff options
context:
space:
mode:
authorMatthías Páll Gissurarson <mpg@mpg.is>2021-06-14 00:12:50 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-10-05 03:18:39 -0400
commit5601b9e249661a16f4bfb14958fe10d950e7e589 (patch)
tree0e8d1079aabd715e419529ff2cbbcd7a19e92129 /compiler/GHC/Tc/Solver.hs
parent48b0f17acff0c35df2d3b63dd6b624832cd54852 (diff)
downloadhaskell-5601b9e249661a16f4bfb14958fe10d950e7e589.tar.gz
Speed up valid hole-fits by adding early abort and checks.
By adding an early abort flag in `TcSEnv`, we can fail fast in the presence of insoluble constraints. This helps us avoid a lot of work in valid hole-fits, and we geta massive speed-up by avoiding a lot of useless work solving constraints that never come into play. Additionally, we add a simple check for degenerate hole types, such as when the type of the hole is an immutable type variable (as is the case when the hole is completely unconstrained). Then the only valid fits are the locals, so we can ignore the global candidates. This fixes #16875
Diffstat (limited to 'compiler/GHC/Tc/Solver.hs')
-rw-r--r--compiler/GHC/Tc/Solver.hs6
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/GHC/Tc/Solver.hs b/compiler/GHC/Tc/Solver.hs
index 6d9770adbf..276c0b284b 100644
--- a/compiler/GHC/Tc/Solver.hs
+++ b/compiler/GHC/Tc/Solver.hs
@@ -23,7 +23,11 @@ module GHC.Tc.Solver(
-- For Rules we need these
solveWanteds, solveWantedsAndDrop,
- approximateWC, runTcSDeriveds
+ approximateWC, runTcSDeriveds,
+
+ -- We need this for valid hole-fits
+ runTcSDerivedsEarlyAbort
+
) where
import GHC.Prelude