[commit: ghc] master: Print explicit foralls in type family eqns when appropriate (f932b1a)

git at git.haskell.org git at git.haskell.org
Mon Nov 26 18:57:30 UTC 2018


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/f932b1aa42f45625658c8abaf862cc570507c5ca/ghc

>---------------------------------------------------------------

commit f932b1aa42f45625658c8abaf862cc570507c5ca
Author: Ryan Scott <ryan.gl.scott at gmail.com>
Date:   Mon Nov 26 12:59:09 2018 -0500

    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


>---------------------------------------------------------------

f932b1aa42f45625658c8abaf862cc570507c5ca
 compiler/iface/IfaceSyn.hs                 | 46 +++++++++++++-------------
 compiler/iface/IfaceType.hs                | 53 ++++++++++++++++++++++++++++++
 compiler/main/PprTyThing.hs                | 10 ++++--
 testsuite/tests/ghci/scripts/T13420.stdout |  9 +++--
 testsuite/tests/ghci/scripts/T15341.stdout |  8 ++---
 testsuite/tests/ghci/scripts/T15827.hs     | 16 +++++++++
 testsuite/tests/ghci/scripts/T15827.script |  4 +++
 testsuite/tests/ghci/scripts/T15827.stdout |  9 +++++
 testsuite/tests/ghci/scripts/T4175.stdout  |  7 ++--
 testsuite/tests/ghci/scripts/T7939.stdout  | 22 ++++++-------
 testsuite/tests/ghci/scripts/T8674.stdout  |  3 +-
 testsuite/tests/ghci/scripts/T9181.stdout  |  2 +-
 testsuite/tests/ghci/scripts/all.T         |  1 +
 13 files changed, 138 insertions(+), 52 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 f932b1aa42f45625658c8abaf862cc570507c5ca


More information about the ghc-commits mailing list