lspitzner / brittany

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

Equational constraint produces syntactically invalid result #267

Closed mx-psi closed 4 years ago

mx-psi commented 4 years ago

Running brittany 0.12.1.0 with the following program

{-# LANGUAGE TypeFamilies #-}

f :: ((~) a b) => a -> b
f = id

outputs ERROR: brittany pretty printer returned syntactically invalid result.

tfausak commented 4 years ago

Here's what Brittany outputs with --output-on-errors:

{-# LANGUAGE TypeFamilies #-}
f :: ((Data.Type.Equality~) a b) => a -> b
f = id

Also worth noting that the following equivalent program works fine:

{-# language TypeFamilies #-}
f :: a ~ b => a -> b
f = id

Might be somewhat related to #258.

lspitzner commented 4 years ago

We already have some special-casing around this at

https://github.com/lspitzner/brittany/blob/059bb9402e207c1be0a2f7a9f0673238240531fe/src/Language/Haskell/Brittany/Internal/LayouterBasics.hs#L235-L239

I wonder why this does not trigger here.

lspitzner commented 4 years ago

Should be fixed in 77d6d5b553720102f05b3977f89566f2c5c1960b, will merge into master if CI is green in a few minutes.

lspitzner commented 4 years ago

fixed in 0.12.1.1