[commit: ghc] master: Fix #16030 by refactoring IfaceSyn's treatment of GADT constructors (9d9e355)

git at git.haskell.org git at git.haskell.org
Wed Dec 19 19:57:46 UTC 2018


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

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

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

commit 9d9e35574a92773d872efd58a67339a9e054a9f1
Author: Ryan Scott <ryan.gl.scott at gmail.com>
Date:   Wed Dec 19 19:17:58 2018 +0100

    Fix #16030 by refactoring IfaceSyn's treatment of GADT constructors
    
    Summary:
    GHCi's `:info` command was pretty-printined GADT
    constructors suboptimally in the following ways:
    
    1. Sometimes, fields were parenthesized when they did not need it,
       e.g.,
    
    ```lang=haskell
    data Foo a where
      MkFoo :: (Maybe a) -> Foo a
    ```
    
       I fixed this by refactoring some code in `pprIfaceConDecl` to be a
       little smarter with respect to GADT syntax. See `pprFieldArgTy`
       and `pprArgTy`.
    2. With `-fprint-explicit-kinds` enabled, there would be times when
       specified arguments would be printed without a leading `@` in GADT
       return types, e.g.,
    
    ```lang=haskell
    data Bar @k (a :: k) where
      MkBar :: Bar k a
    ```
    
       It turns out that `ppr_tc_app`, the function which pretty-prints
       these return types, was not using the proper machinery to print
       out the arguments, which caused the visibilities to be forgotten
       entirely. I refactored `ppr_tc_app` to do this correctly.
    
    Test Plan: make test TEST=T16030
    
    Reviewers: goldfire, bgamari, simonpj
    
    Reviewed By: simonpj
    
    Subscribers: simonpj, rwbarton, carter
    
    GHC Trac Issues: #16030
    
    Differential Revision: https://phabricator.haskell.org/D5440


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

9d9e35574a92773d872efd58a67339a9e054a9f1
 compiler/iface/IfaceSyn.hs                 | 101 ++++++++++++++++++++---------
 compiler/iface/IfaceType.hs                |   2 +-
 testsuite/tests/ghci/scripts/T16030.hs     |  15 +++++
 testsuite/tests/ghci/scripts/T16030.script |   4 ++
 testsuite/tests/ghci/scripts/T16030.stdout |  22 +++++++
 testsuite/tests/ghci/scripts/all.T         |   1 +
 6 files changed, 114 insertions(+), 31 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 9d9e35574a92773d872efd58a67339a9e054a9f1


More information about the ghc-commits mailing list