diff options
author | Ryan Scott <ryan.gl.scott@gmail.com> | 2018-11-26 12:59:09 -0500 |
---|---|---|
committer | Ryan Scott <ryan.gl.scott@gmail.com> | 2018-11-26 12:59:11 -0500 |
commit | f932b1aa42f45625658c8abaf862cc570507c5ca (patch) | |
tree | 0755ee1ce530f0afee8a6b5ec44f22e53eee3cc5 /testsuite/tests/ghci/scripts/T15341.stdout | |
parent | df570d920fa66db631f936fa377e598fe92bd2a1 (diff) | |
download | haskell-f932b1aa42f45625658c8abaf862cc570507c5ca.tar.gz |
Print explicit foralls in type family eqns when appropriate
Summary:
When `-fprint-explicit-foralls` is enabled, type family
equations are either printed without an explict `forall` entirely,
or with a bizarre square bracket syntax (in the case of closed type
families). I find neither satisfying, so in this patch, I introduce
support for printing explicit `forall`s in open type-family, closed
type-family, and data-family equations when appropriate. (By "when
appropriate", I refer to the conditions laid out in
`Note [When to print foralls]` in `IfaceType`.)
One tricky point in the implementation is that I had to pick a
visibility for each type variable in a `CoAxiom`/`FamInst` in order
to be able to pass it to `pprUserIfaceForAll` //et al.// Because
the type variables in a type family instance equation can't be
instantiated by the programmer anyway, the choice only really matters
for pretty-printing purposes, so I simply went with good ol'
trustworthy `Specified`. (This design choice is documented in
`Note [Printing foralls in type family instances]` in `IfaceType`.)
Test Plan: make test TEST=T15827
Reviewers: goldfire, bgamari, simonpj
Reviewed By: simonpj
Subscribers: simonpj, rwbarton, carter
GHC Trac Issues: #15827
Differential Revision: https://phabricator.haskell.org/D5282
Diffstat (limited to 'testsuite/tests/ghci/scripts/T15341.stdout')
-rw-r--r-- | testsuite/tests/ghci/scripts/T15341.stdout | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/testsuite/tests/ghci/scripts/T15341.stdout b/testsuite/tests/ghci/scripts/T15341.stdout index 0633ae5b39..e2555f9ac9 100644 --- a/testsuite/tests/ghci/scripts/T15341.stdout +++ b/testsuite/tests/ghci/scripts/T15341.stdout @@ -1,6 +1,6 @@ -type family Foo (a :: k) :: k - where Foo a = a +type family Foo (a :: k) :: k where + forall k (a :: k). Foo a = a -- Defined at T15341.hs:5:1 -type family Foo @k (a :: k) :: k - where Foo @k a = a +type family Foo @k (a :: k) :: k where + forall k (a :: k). Foo @k a = a -- Defined at T15341.hs:5:1 |