lspitzner / lspitzner/brittany

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

Open
#348 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug language extension support
Dominant language
Haskell
Stars
686
Forks
69
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the DataKinds examples in the report and compare the formatter's output for type-level lists with type-level tuples. Trace the formatting path for bracketed type-level lists; done means the space between the opening bracket and second tick is preserved and the formatted declarations remain valid Haskell.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.