tweag / ormolu

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

RecordDotSyntax support #486

Closed Avi-D-coder closed 4 years ago

Avi-D-coder commented 4 years ago

Is it possible to add support for expr.lbl and (.lbl) in ormolu prior to RecordDotSyntax coming to GHC? Both forms are implemented in the record-dot-preprocessor and will be in GHC once RecordDotSyntax is implemented.

neongreen commented 4 years ago

Not before they land in the GHC parser.

On Tue, Dec 31, 2019, 02:34 Avi Dessauer notifications@github.com wrote:

Is it possible to add support for expr.lbl and (.lbl) in ormolu prior to RecordDotSyntax coming to GHC? Both forms are implemented in the record-dot-preprocessor https://github.com/ndmitchell/record-dot-preprocessor and will be in GHC once RecordDotSyntax is implemented.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/tweag/ormolu/issues/486?email_source=notifications&email_token=AALT42XRLNRKNH6P7NDCSMTQ3KARDA5CNFSM4KBRBYK2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IDNNY7A, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALT42QU4EAVJU2PC7YG3XDQ3KARDANCNFSM4KBRBYKQ .

neongreen commented 4 years ago

My understanding of the preprocessor is that it recognizes certain bits of syntax and substitutes them with HasField methods. However, it does not provide an extended version of the AST that would correspond to Haskell+RecordDotSyntax. So we can't reuse the record-dot-preprocessor code (much).

On Tue, Dec 31, 2019, 14:55 Artyom Kazak artyom@artyom.me wrote:

Not before they land in the GHC parser.

On Tue, Dec 31, 2019, 02:34 Avi Dessauer notifications@github.com wrote:

Is it possible to add support for expr.lbl and (.lbl) in ormolu prior to RecordDotSyntax coming to GHC? Both forms are implemented in the record-dot-preprocessor https://github.com/ndmitchell/record-dot-preprocessor and will be in GHC once RecordDotSyntax is implemented.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/tweag/ormolu/issues/486?email_source=notifications&email_token=AALT42XRLNRKNH6P7NDCSMTQ3KARDA5CNFSM4KBRBYK2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IDNNY7A, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALT42QU4EAVJU2PC7YG3XDQ3KARDANCNFSM4KBRBYKQ .

Avi-D-coder commented 4 years ago

I think I have a workable solution. I'll submit a PR latter today.

Avi-D-coder commented 4 years ago

It works I just have to pass recDotPreOn::Bool derived from DynFlagssrc/Ormolu/Parser.hs into src/Ormolu/Printer/Meat/Declaration/Value.hs. Is the R newtype the place to pass this info?