TH pretty-printer prints symbolic data family name without parentheses
Summary
Another day, another TH pretty-printer bug. An operator data family
declaration gets printed in prefix position and with no parentheses. An equivalent type family
declaration is correctly printed with parentheses.
Steps to reproduce
$ ghci -XTypeFamilies -XTypeOperators -XTemplateHaskell
GHCi, version 9.6.2: https://www.haskell.org/ghc/ :? for help
ghci> Language.Haskell.TH.runQ [d|data family (a + b) c d|] >>= putStrLn . Language.Haskell.TH.Ppr.pprint
data family +_0 a_1 b_2 c_3 d_4
Expected behavior
The same thing done for type family
:
$ ghci -XTypeFamilies -XTypeOperators -XTemplateHaskell
GHCi, version 9.6.2: https://www.haskell.org/ghc/ :? for help
ghci> Language.Haskell.TH.runQ [d|type family (a + b) c d|] >>= putStrLn . Language.Haskell.TH.Ppr.pprint
type family (+_0) a_1 b_2 c_3 d_4
Environment
- GHC version used: 9.6.2