lspitzner / brittany

haskell source code formatter
GNU Affero General Public License v3.0
690 stars 72 forks source link

DataKinds: ticks inside type-level lists are not correctly spaced #348

Open chfin opened 3 years ago

chfin commented 3 years ago

For the following input, brittany produces invalid output:

{-# LANGUAGE DataKinds #-}
-- this fails
type A x y = '[ '(x, y)]
type B x = '[ '[x]]
-- formatted as:
-- type A x y = '['(x, y)]
-- type B x = '['[x]]

-- this works
type C x y = '( '[x], '[y])
type D x y = '( '(x, y), '(x, y))

The output removes the space between the bracket and the second tick, which leads to '[' being parsed as a Char literal. This problem does not occur inside type-level tuples.