Skip to content

Missing space when printing lists

When printing a promoted list containing a promoted constructor, GHC adds a space to avoid spelling '[', which is a type-level character:

ghci> type T = '[ 'False]
ghci> :i T
type T :: [Bool]
type T = '[ 'False] :: [Bool]

But this does not happen if a list starts with a type-level character:

ghci> type R = '[ 'a']
ghci> :i R
type R :: [Char]
type R = '['a'] :: [Char]

Here '['a'] is invalid syntax.

Newcomer-only ticket. The relevant code should be around the function pprSpaceIfPromotedTyCon.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information