Fix #16030 by refactoring IfaceSyn's treatment of GADT constructors

Authored by RyanGlScott on Dec 11 2018, 11:41 AM.



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.,
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`.
  1. With -fprint-explicit-kinds enabled, there would be times when specified arguments would be printed without a leading @ in GADT return types, e.g.,
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

Diff Detail

rGHC Glasgow Haskell Compiler
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
RyanGlScott created this revision.Dec 11 2018, 11:41 AM
simonpj accepted this revision.Dec 13 2018, 10:01 AM
simonpj added a subscriber: simonpj.

Great, thatnks


Strange loss of space before the } here?

This revision is now accepted and ready to land.Dec 13 2018, 10:01 AM
RyanGlScott marked an inline comment as done.
This revision was automatically updated to reflect the committed changes.