tweag / ormolu

A formatter for Haskell source code
https://ormolu-live.tweag.io
Other
956 stars 83 forks source link

Unparseable output with ticked `DataKinds` and char literals #1000

Closed amesgen closed 1 year ago

amesgen commented 1 year ago

Describe the bug Formatting this valid type family

type family Foo a where Foo '( 'x', a) = a

yields

<input>:2:12
  Parsing of formatted code failed:
  parse error on input `,'

Unsafe output:

type family Foo a where
  Foo '('x', a) = a

Expected behavior This should be supported by inserting a space before the second ' as in the original input; we are already handling similar cases, see #631.

Environment

amesgen commented 1 year ago

The same problem also appears in a type expression context:

type Foo = '[ 'a']