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

Open
opened 2021-05-18 17:28:26 +02:00 by chfin · 0 comments
chfin commented 2021-05-18 17:28:26 +02:00 (Migrated from github.com)

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.

For the following input, brittany produces invalid output: ```haskell {-# 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.
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: hexagoxel/brittany#348
There is no content yet.