diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2017-03-10 11:20:00 +0000 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2017-03-10 16:04:39 +0000 |
commit | 7e96526ac2ef5987ecb03217d3d616b6281c1441 (patch) | |
tree | ed201840c894bcb71f8811e839fedc82308cfaf7 /testsuite/tests/polykinds/T13393.stderr | |
parent | bc0f3abd0914808e33f84229818ab90842611bdd (diff) | |
download | haskell-7e96526ac2ef5987ecb03217d3d616b6281c1441.tar.gz |
Fix TcSimplify.decideQuantification for kind variables
TcSimplify.decideQuantification was doing the Wrong Thing when
"growing" the type variables to quantify over. We were trying to do
this on a tyvar set where we'd split off the dependent type varaibles;
and we just got it wrong. A kind variable wasn't being generalised
properly, with confusing knock on consequences.
All this led to Trac #13371 and Trac #13393.
This commit tidies it all up:
* The type TcDepVars is renamed as CandidateQTvs;
and splitDepVarsOfType to candidateQTyVarsOfType
* The code in TcSimplify.decideQuantification is simpler.
It no longer does the tricky "grow" stuff over TcDepVars.
Instead it use ordinary VarSets (thereby eliminating the
nasty growThetaTyVarsDSet) and uses that to filter the
result of candidateQTyVarsOfType.
* I documented that candidateQTyVarsOfType returns the type
variables in a good order in which to quantify, and rewrote
it to use an accumulator pattern, so that we would predicatably
get left-to-right ordering.
In doing all this I also made UniqDFM behave a little more nicely:
* When inserting an element that is there already, keep the old tag,
while still overwriting with the new value.
* This means that when doing udfmToList we get back elements in the
order they were originally inserted, rather than in reverse order.
It's not a big deal, but in a subsequent commit I use it to improve
the order of type variables in inferred types.
All this led to a lot of error message wibbles:
- changing the order of quantified variables
- changing the order in which instances are listed in GHCi
- changing the tidying of variables in typechecker erors
There's a submodule update for 'array' because one of its tests
has an error-message change.
I may not have associated all of them with the correct commit.
Diffstat (limited to 'testsuite/tests/polykinds/T13393.stderr')
-rw-r--r-- | testsuite/tests/polykinds/T13393.stderr | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/testsuite/tests/polykinds/T13393.stderr b/testsuite/tests/polykinds/T13393.stderr new file mode 100644 index 0000000000..39ea640633 --- /dev/null +++ b/testsuite/tests/polykinds/T13393.stderr @@ -0,0 +1,25 @@ + +T13393.hs:61:3: error: + • Ambiguous type variable ‘t0’ arising from a use of ‘mapM’ + prevents the constraint ‘(Traversable t0)’ from being solved. + Probable fix: use a type annotation to specify what ‘t0’ should be. + These potential instances exist: + instance Traversable (Either a) -- Defined in ‘Data.Traversable’ + instance Traversable Identity -- Defined in ‘Data.Traversable’ + instance Traversable Maybe -- Defined in ‘Data.Traversable’ + ...plus two others + ...plus 24 instances involving out-of-scope types + (use -fprint-potential-instances to see them all) + • In a stmt of a 'do' block: + mapM putBackLeftOverInputAndReturnOutput undefined + In the expression: + do mapM putBackLeftOverInputAndReturnOutput undefined + undefined + In an equation for ‘encodeLinearToAac’: + encodeLinearToAac + = do mapM putBackLeftOverInputAndReturnOutput undefined + undefined + where + putBackLeftOverInputAndReturnOutput (MkEncodeResult x) + = do leftOvers .= x + .... |