Skip to content

TH pretty-printer parnthesizes the ground type kind `*`, turning it into a type operator

Summary

Language.Haskell.TH.Ppr.pprint prints the Language.Haskell.TH.StarT constructor, representing the star from StarIsType, parenthesized. This in turn makes it parse as a type operator (*). Interestingly, this doesn't happen when the * is the whole kind by itself.

Steps to reproduce

$ ghci -XStarIsType -XTemplateHaskell -Wno-star-is-type
GHCi, version 9.6.2: https://www.haskell.org/ghc/  :? for help
ghci> Language.Haskell.TH.runQ [|typeOf (Data.Typeable.Proxy :: Data.Typeable.Proxy *)|] >>= putStrLn . Language.Haskell.TH.Ppr.pprint
typeOf (Data.Proxy.Proxy :: Data.Proxy.Proxy (*))

Expected behavior

The output on the last line ought to be

typeOf (Data.Proxy.Proxy :: Data.Proxy.Proxy *)

Environment

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