Skip to content

TH pretty-printer prints symbolic class names without parentheses

Summary

Given a type class declaration that defines an infix type operator, Language.Haskell.TH.Ppr.pprint emits it in prefix position and with no parentheses.

Steps to reproduce

$ ghci -XMultiParamTypeClasses -XTypeOperators -XTemplateHaskell
GHCi, version 9.6.2: https://www.haskell.org/ghc/  :? for help
ghci> Language.Haskell.TH.runQ [d|class a ## b|] >>= putStrLn . Language.Haskell.TH.Ppr.pprint
class ##_0 a_1 b_2

Expected behavior

The output line should be

class (##_0) a_1 b_2

Environment

  • GHC version used: 9.6.2
Edited by Mario
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information