tweag / ormolu

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

Record updates and record-dot-preprocessor #498

Closed pkapustin closed 4 years ago

pkapustin commented 4 years ago

The record update syntax in record-dot-preprocessor relies on the fact that in expr{lbl = val} the { cannot have whitespace before it, but ormolu inserts an extra space. I think that the spacing around { in record updates should not be changed in the files that use record-dot-preprocessor.

neongreen commented 4 years ago

@Avi-D-coder can you take a look at this?

Avi-D-coder commented 4 years ago

@pkapustin thanks for pointing this out. Test case for this.

data FooBar = FooBar {foo :: Int, bar :: Int} deriving (Show)

newtype Foo = Foo {foo :: Int} deriving (Show)

fooplus f n = f {foo = f.foo + n} -- Error: Record update is ambiguous