[GHC] #13887: Template Haskell pretty-printer doesn't parenthesize infix datatype names in data declarations
GHC
ghc-devs at haskell.org
Fri Jul 7 20:11:20 UTC 2017
#13887: Template Haskell pretty-printer doesn't parenthesize infix datatype names
in data declarations
-------------------------------------+-------------------------------------
Reporter: RyanGlScott | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Template Haskell | Version: 8.0.1
Resolution: | Keywords: newcomer
Operating System: Unknown/Multiple | Architecture:
Type of failure: Incorrect result | Unknown/Multiple
at runtime | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by ak3n):
I am not sure, but I think that it's enough to change `pprName' Alone` to
`pprName' Applied` [https://git.haskell.org/ghc.git/blob/HEAD:/libraries
/template-haskell/Language/Haskell/TH/PprLib.hs#l123 here].
There are 8 failed tests in `testsuite/tests/th` because of this change:
- `GHC.Types.:` becomes `(GHC.Types.:)`
- `Data.Type.Equality.~` becomes `(Data.Type.Equality.~)`
- and something else
There is another way to fix it.
Change `ppr t` to `pprName' Applied t`
[https://git.haskell.org/ghc.git/blob/HEAD:/libraries/template-
haskell/Language/Haskell/TH/Ppr.hs#l401 here], which outputs:
{{{
data (:~:_0) a_1 b_2 where Refl1_3 :: :~:_0 a_4 a_4
data (:~~:_0) a_1 b_2 = a_1 ~ b_2 => Refl2_3
}}}
This [https://git.haskell.org/ghc.git/blob/HEAD:/libraries/template-
haskell/Language/Haskell/TH/Ppr.hs#l402 line] is responsible for the kind
of `Refl1_3`, but I haven't figured out how to fix it yet.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13887#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list