Overhaul -fprint-explicit-kinds to use VKA
authorRyan Scott <ryan.gl.scott@gmail.com>
Thu, 22 Nov 2018 16:55:00 +0000 (11:55 -0500)
committerBen Gamari <ben@smart-cactus.org>
Thu, 22 Nov 2018 18:14:02 +0000 (13:14 -0500)
commitf5d2083807a03c57f194fcc3a7baf82e34aad524
tree9853fb8ba47bbdd1488ded82672ca0087a7b2a98
parentff619555439a8fc671fffb239910972b054a7d96
Overhaul -fprint-explicit-kinds to use VKA

This patch changes the behavior of `-fprint-explicit-kinds`
so that it displays kind argument using visible kind application.
In other words, the flag now:

1. Prints instantiations of specified variables with `@(...)`.
2. Prints instantiations of inferred variables with `@{...}`.

In addition, this patch removes the `Use -fprint-explicit-kinds to
see the kind arguments` error message that often arises when a type
mismatch occurs due to different kinds. Instead, whenever there is a
kind mismatch, we now enable the `-fprint-explicit-kinds` flag
locally to help cue to the programmer where the error lies.
(See `Note [Kind arguments in error messages]` in `TcErrors`.)
As a result, these funny `@{...}` things can now appear to the user
even without turning on the `-fprint-explicit-kinds` flag explicitly,
so I took the liberty of documenting them in the users' guide.

Test Plan: ./validate

Reviewers: goldfire, simonpj, bgamari

Reviewed By: simonpj

Subscribers: rwbarton, carter

GHC Trac Issues: #15871

Differential Revision: https://phabricator.haskell.org/D5314
29 files changed:
compiler/backpack/RnModIface.hs
compiler/basicTypes/Var.hs
compiler/iface/IfaceSyn.hs
compiler/iface/IfaceType.hs
compiler/iface/ToIface.hs
compiler/typecheck/FamInst.hs
compiler/typecheck/FunDeps.hs
compiler/typecheck/TcErrors.hs
compiler/typecheck/TcType.hs
compiler/typecheck/TcValidity.hs
compiler/types/TyCoRep.hs
compiler/types/Type.hs
docs/users_guide/using.rst
testsuite/tests/dependent/should_fail/T15825.stderr
testsuite/tests/generics/T10604/T10604_deriving.stderr
testsuite/tests/ghci/scripts/GhciKinds.stdout
testsuite/tests/ghci/scripts/T11376.stdout
testsuite/tests/ghci/scripts/T15341.stdout
testsuite/tests/ghci/scripts/T6018ghcifail.stderr
testsuite/tests/indexed-types/should_fail/T9171.stderr
testsuite/tests/partial-sigs/should_compile/T15039b.stderr
testsuite/tests/partial-sigs/should_compile/T15039d.stderr
testsuite/tests/polykinds/T10570.stderr
testsuite/tests/polykinds/T14520.stderr
testsuite/tests/polykinds/T9144.stderr
testsuite/tests/polykinds/TidyClassKinds.stderr
testsuite/tests/typecheck/should_fail/T15515.stderr
testsuite/tests/typecheck/should_fail/T6018fail.stderr
testsuite/tests/typecheck/should_fail/T6018failclosed.stderr