summaryrefslogtreecommitdiff
path: root/compiler/GHC/Tc/Utils/Monad.hs
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2020-12-08 13:50:42 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-12-20 20:46:31 -0500
commit995a8f9d2bd0e98480a8c60498fdfff1fb8de009 (patch)
tree61242096fd19d009128a59fd22a09d66a656fa0d /compiler/GHC/Tc/Utils/Monad.hs
parent35fa0786b6ded2420f0a07446c8e45bff9bb01e0 (diff)
downloadhaskell-995a8f9d2bd0e98480a8c60498fdfff1fb8de009.tar.gz
Kill floatEqualities completely
This patch delivers on #17656, by entirel killing off the complex floatEqualities mechanism. Previously, floatEqualities would float an equality out of an implication, so that it could be solved at an outer level. But now we simply do unification in-place, without floating the constraint, relying on level numbers to determine untouchability. There are a number of important new Notes: * GHC.Tc.Utils.Unify Note [Unification preconditions] describes the preconditions for unification, including both skolem-escape and touchability. * GHC.Tc.Solver.Interact Note [Solve by unification] describes what we do when we do unify * GHC.Tc.Solver.Monad Note [The Unification Level Flag] describes how we control solver iteration under this new scheme * GHC.Tc.Solver.Monad Note [Tracking Given equalities] describes how we track when we have Given equalities * GHC.Tc.Types.Constraint Note [HasGivenEqs] is a new explanation of the ic_given_eqs field of an implication A big raft of subtle Notes in Solver, concerning floatEqualities, disappears. Main code changes: * GHC.Tc.Solver.floatEqualities disappears entirely * GHC.Tc.Solver.Monad: new fields in InertCans, inert_given_eq_lvl and inert_given_eq, updated by updateGivenEqs See Note [Tracking Given equalities]. * In exchange for updateGivenEqa, GHC.Tc.Solver.Monad.getHasGivenEqs is much simpler and more efficient * I found I could kill of metaTyVarUpdateOK entirely One test case T14683 showed a 5.1% decrease in compile-time allocation; and T5631 was down 2.2%. Other changes were small. Metric Decrease: T14683 T5631
Diffstat (limited to 'compiler/GHC/Tc/Utils/Monad.hs')
-rw-r--r--compiler/GHC/Tc/Utils/Monad.hs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/GHC/Tc/Utils/Monad.hs b/compiler/GHC/Tc/Utils/Monad.hs
index 5cb8ed8d88..240a836d72 100644
--- a/compiler/GHC/Tc/Utils/Monad.hs
+++ b/compiler/GHC/Tc/Utils/Monad.hs
@@ -1865,7 +1865,7 @@ It's distressingly delicate though:
class constraints mentioned above. But we may /also/ end up taking
constraints built at some inner level, and emitting them at some
outer level, and then breaking the TcLevel invariants
- See Note [TcLevel and untouchable type variables] in GHC.Tc.Utils.TcType
+ See Note [TcLevel invariants] in GHC.Tc.Utils.TcType
So dropMisleading has a horridly ad-hoc structure. It keeps only
/insoluble/ flat constraints (which are unlikely to very visibly trip