diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2015-04-29 13:43:09 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2015-04-29 15:05:44 +0100 |
commit | a1275a762ec04c1159ae37199b1c8f998a5c5499 (patch) | |
tree | 6d01de796910a7857c5f91661a40592f67d62090 /testsuite/tests/typecheck/should_fail/T5689.stderr | |
parent | d9bb0ee78b2104bd5c71508080d068804086ae84 (diff) | |
download | haskell-a1275a762ec04c1159ae37199b1c8f998a5c5499.tar.gz |
Improve improvement in the constraint solver
This regrettably-big patch substantially improves the way in which
"improvement" happens in the constraint solver. It was triggered by
trying to crack Trac #10009, but it turned out to solve #10340 as
well.
The big picture, with several of the trickiest examples, is described
in Note [The improvement story] in TcInteract.
The major change is this:
* After solving we explicitly try "improvement", by
- making the unsolved Wanteds into Deriveds
- allowing Deriveds to rewrite Deriveds
This more aggressive rewriting "unlocks" some extra
guess-free unifications.
* The main loop is in TcInteract.solveSimpleWanteds, but I also ended
up refactoring TcSimplify.simpl_loop, and its surrounding code.
Notably, any insolubles from the Givens are pulled out
and treated separately, rather than staying in the inert set
during the solveSimpleWanteds loop.
There are a lot of follow-on changes
* Do not emit generate Derived improvements from Wanteds.
This saves work in the common case where they aren't needed.
* For improvement we should really do type-class reduction on Derived
constraints in doTopReactDict. That entailed changing the GenInst
constructor a bit; a local and minor change
* Some annoying faffing about with dropping derived constraints;
see dropDerivedWC, dropDerivedSimples, dropDerivedInsols,
and their Notes.
* Some substantial refactoring in TcErrors.reportWanteds.
This work wasn't strictly forced, but I got sucked into it.
All the changes are in TcErrors.
* Use TcS.unifyTyVar consistently, rather than setWantedTyBind,
so that unifications are properly tracked.
* Refactoring around solveWantedsTcM, solveWantedsAndDrop.
They previously guaranteed a zonked result, but it's more
straightforward for clients to zonk.
Diffstat (limited to 'testsuite/tests/typecheck/should_fail/T5689.stderr')
-rw-r--r-- | testsuite/tests/typecheck/should_fail/T5689.stderr | 26 |
1 files changed, 1 insertions, 25 deletions
diff --git a/testsuite/tests/typecheck/should_fail/T5689.stderr b/testsuite/tests/typecheck/should_fail/T5689.stderr index 211ec522a1..f8294f4705 100644 --- a/testsuite/tests/typecheck/should_fail/T5689.stderr +++ b/testsuite/tests/typecheck/should_fail/T5689.stderr @@ -1,32 +1,8 @@ -T5689.hs:10:36: +T5689.hs:10:36: error: Couldn't match expected type ‘Bool’ with actual type ‘t’ Relevant bindings include v :: t (bound at T5689.hs:10:28) r :: IORef (t -> t) (bound at T5689.hs:7:14) In the expression: v In the expression: if v then False else True - -T5689.hs:10:43: - Couldn't match expected type ‘t’ with actual type ‘Bool’ - Relevant bindings include - v :: t (bound at T5689.hs:10:28) - r :: IORef (t -> t) (bound at T5689.hs:7:14) - In the expression: False - In the expression: if v then False else True - -T5689.hs:10:54: - Couldn't match expected type ‘t’ with actual type ‘Bool’ - Relevant bindings include - v :: t (bound at T5689.hs:10:28) - r :: IORef (t -> t) (bound at T5689.hs:7:14) - In the expression: True - In the expression: if v then False else True - -T5689.hs:14:23: - Couldn't match expected type ‘t’ with actual type ‘Bool’ - Relevant bindings include - c :: t -> t (bound at T5689.hs:12:13) - r :: IORef (t -> t) (bound at T5689.hs:7:14) - In the first argument of ‘c’, namely ‘True’ - In the second argument of ‘($)’, namely ‘c True’ |