Skip to content

The `ParensT` constructor is ignored by `pprParendType`

Summary

The instance Ppr Type provided by Template Haskell doesn't parenthesize infix type arguments even when they're explicitly wrapped in the ParensT constructor.

Steps to reproduce

$ ghci-9.2.3 
GHCi, version 9.2.3: https://www.haskell.org/ghc/  :? for help
ghci> :module + Language.Haskell.TH
ghci> pprint (InfixT (ArrowT `AppT` StarT `AppT` StarT) (mkName ":>:") StarT)
"(* -> * :>: *)"
ghci> pprint (InfixT (ParensT $ ArrowT `AppT` StarT `AppT` StarT) (mkName ":>:") StarT)
"(* -> * :>: *)"

Expected behavior

ghci> pprint (InfixT (ParensT $ ArrowT `AppT` StarT `AppT` StarT) (mkName ":>:") StarT)
"((* -> *) :>: *)"

Environment

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