Support record dot syntax #332

Open
opened 2020-12-11 17:15:38 +01:00 by andys8 · 4 comments
andys8 commented 2020-12-11 17:15:38 +01:00 (Migrated from github.com)

There is a proposal for record dot syntax and the preprocessor.

Although this is probably still early, support for the new syntax would be awesome. One thing I notices is the following:

brittany will take a field access and split it apart because it's parsed as function composition.

x = a.b
x = a . b

For this example, it might be enough to not add whitespaces in this case.

(regarding complete support, there might be more issues)

There is [a proposal for record dot syntax](https://ghc-proposals.readthedocs.io/en/latest/proposals/0282-record-dot-syntax.html) and the [preprocessor](https://hackage.haskell.org/package/record-dot-preprocessor). Although this is probably still early, support for the new syntax would be awesome. One thing I notices is the following: brittany will take a field access and split it apart because it's parsed as function composition. ``` x = a.b ``` ``` x = a . b ``` For this example, it might be enough to not add whitespaces in this case. (regarding complete support, there might be more issues)
tfausak commented 2020-12-11 17:41:41 +01:00 (Migrated from github.com)

This will almost certainly require support from ghc-exactprint before Brittany can do anything about it.

This will almost certainly require support from ghc-exactprint before Brittany can do anything about it.
mrkkrp commented 2020-12-11 19:38:53 +01:00 (Migrated from github.com)

You could check how Ormolu does this. Ormolu only depends on ghc-lib-parser.

You could check how Ormolu does this. Ormolu only depends on `ghc-lib-parser`.
andys8 commented 2021-04-01 19:30:19 +02:00 (Migrated from github.com)

Record for syntax seems to land with GHC 9.2

Record for syntax seems to land with GHC 9.2
andys8 commented 2021-08-24 18:19:23 +02:00 (Migrated from github.com)

ghc-exactprint with support for GHC 9.2 RC1

https://twitter.com/alan_zimm/status/1429911651340406795

`ghc-exactprint` with support for GHC 9.2 RC1 https://twitter.com/alan_zimm/status/1429911651340406795
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#332
There is no content yet.