[commit: ghc] master: Allow foralls in instance decls (2cf3cac)
git at git.haskell.org
git at git.haskell.org
Mon Feb 8 09:06:01 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/2cf3cac6a05879c27fa82b12dd34cce39a262402/ghc
>---------------------------------------------------------------
commit 2cf3cac6a05879c27fa82b12dd34cce39a262402
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.
>---------------------------------------------------------------
2cf3cac6a05879c27fa82b12dd34cce39a262402
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 | 74 +++--
testsuite/tests/gadt/T3163.stderr | 6 +-
.../indexed-types/should_fail/SimpleFail15.stderr | 7 +-
.../tests/indexed-types/should_fail/T10899.stderr | 4 +-
.../tests/indexed-types/should_fail/T9357.stderr | 2 +-
.../tests/rename/should_fail/rnfail026.stderr | 4 +-
.../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/tcfail184.stderr | 11 +-
.../tests/typecheck/should_fail/tcfail195.stderr | 6 +-
.../tests/typecheck/should_fail/tcfail196.stderr | 3 +-
.../tests/typecheck/should_fail/tcfail197.stderr | 2 +-
30 files changed, 386 insertions(+), 379 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 2cf3cac6a05879c27fa82b12dd34cce39a262402
More information about the ghc-commits
mailing list