[commit: ghc] ghc-8.0: Allow foralls in instance decls (28c26d9)
git at git.haskell.org
git at git.haskell.org
Thu Feb 18 12:03:38 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : ghc-8.0
Link : http://ghc.haskell.org/trac/ghc/changeset/28c26d9da990e4889f77b562fb76fb79e71f9ef2/ghc
>---------------------------------------------------------------
commit 28c26d9da990e4889f77b562fb76fb79e71f9ef2
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date: Mon Feb 8 09:05:12 2016 +0000
Allow foralls in instance decls
This patch finally makes it possible to have explicit
foralls in an instance decl
instance forall (a :: *). Eq a => Eq [a] where ...
This is useful to allow kind signatures or indeed
explicicit kind for-alls; see Trac #11519
I thought it would be really easy, because an instance
declaration already contains an actual HsSigType, so all
the syntactic baggage is there. But in fact it turned
out that instance declarations were kind-checked a
little differently, because the body kind of the forall
is 'Constraint' rather than '*'.
So I fixed that. There a slight kludge
(see Note [Body kind of a HsQualTy], but it's still a
significant improvement.
I also did the usual other round of refactoring,
improved a few error messages, tidied up comments etc.
The only significant aspect of all that was
* Kill mkNakedSpecSigmaTy, mkNakedPhiTy, mkNakedFunTy
These function names suggest that they do something
complicated, but acutally they do nothing. So I
killed them.
* Swap the arg order of mkNamedBinder, just so that it is
convenient to say 'map (mkNamedBinder Invisible) tvs'
* I had to improve isPredTy, to deal with (illegal)
types like
(Eq a => Eq [a]) => blah
See Note [isPeredTy complications] in Type.hs
Still to come: user manual documentation for the
instance-decl change.
(cherry picked from commit 2cf3cac6a05879c27fa82b12dd34cce39a262402)
>---------------------------------------------------------------
28c26d9da990e4889f77b562fb76fb79e71f9ef2
compiler/hsSyn/HsTypes.hs | 301 +++++++++++++--------
compiler/hsSyn/HsUtils.hs | 65 -----
compiler/rename/RnSource.hs | 3 +-
compiler/typecheck/TcBinds.hs | 4 +-
compiler/typecheck/TcHsType.hs | 126 ++++-----
compiler/typecheck/TcInstDcls.hs | 3 +-
compiler/typecheck/TcType.hs | 25 +-
compiler/typecheck/TcValidity.hs | 23 +-
compiler/types/Coercion.hs | 2 +-
compiler/types/TyCoRep.hs | 3 +-
compiler/types/Type.hs | 76 ++++--
testsuite/tests/gadt/T3163.stderr | 6 +-
.../tests/ghci.debugger/scripts/break006.stderr | 4 +-
.../tests/ghci.debugger/scripts/print019.stderr | 2 +-
.../indexed-types/should_fail/SimpleFail12.stderr | 6 +-
.../indexed-types/should_fail/SimpleFail15.stderr | 7 +-
.../tests/indexed-types/should_fail/T10899.stderr | 4 +-
.../tests/indexed-types/should_fail/T9357.stderr | 12 +-
.../should_fail/overloadedlistsfail01.stderr | 4 +-
.../tests/rename/should_fail/rnfail026.stderr | 2 +-
.../tests/typecheck/should_compile/holes2.stderr | 2 +-
.../tests/typecheck/should_fail/T11355.stderr | 2 +-
testsuite/tests/typecheck/should_fail/T2538.stderr | 20 +-
testsuite/tests/typecheck/should_fail/T5957.stderr | 7 +-
testsuite/tests/typecheck/should_fail/T7019.stderr | 8 +-
.../tests/typecheck/should_fail/T7019a.stderr | 9 +-
testsuite/tests/typecheck/should_fail/T7809.stderr | 7 +-
testsuite/tests/typecheck/should_fail/T8806.stderr | 10 -
testsuite/tests/typecheck/should_fail/T9196.stderr | 15 +-
.../tests/typecheck/should_fail/tcfail088.stderr | 6 +-
.../tests/typecheck/should_fail/tcfail127.stderr | 7 +-
.../tests/typecheck/should_fail/tcfail133.stderr | 2 +-
.../tests/typecheck/should_fail/tcfail184.stderr | 11 +-
.../tests/typecheck/should_fail/tcfail195.stderr | 6 +-
.../tests/typecheck/should_fail/tcfail196.stderr | 3 +-
.../tests/typecheck/should_fail/tcfail197.stderr | 2 +-
36 files changed, 401 insertions(+), 394 deletions(-)
Diff suppressed because of size. To see it, use:
git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 28c26d9da990e4889f77b562fb76fb79e71f9ef2
More information about the ghc-commits
mailing list