kztk-m / flippre

Imported from Bitbucket for its sunsetting support of Mercurial.
BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

What is holding this back? #2

Open BebeSparkelSparkel opened 6 months ago

BebeSparkelSparkel commented 6 months ago

Thanks for the reference.

Seems like there is a fair amount of interest in this area but no implementation has had any traction.

What in your opinion is holding bidirectional programming, specifically parsing and printing, from being usable?

kztk-m commented 6 months ago

It's hard to answer. General issues would include the lack of many examples, practicality, and maturity. But they may only be addressed by long-term, continuous development.

Regarding practicality, I personally think some existing approaches, including ours, have (certain) potential, but at least I haven't made enough effort to make this potential evident to users.

Being more technical, parsing/printing is not that symmetric due to control over prettiness (of printing) and lexers. So, to make the system practical, we need to address these things to some extent by certain means. Also, if we want to use some parsing methods that can handle left recursions, we may need to make recursive definitions explicit so that the system can handle them, which would introduce another issue. Haskell does not allow us to change the meaning of recursive definitions, except for value recursions for monads (mfix).

BebeSparkelSparkel commented 6 months ago

Are you using flippre regularly?

For asymmetry of printing I have added Reader and State to the printer monad and ensure that the parser can handle all the variations.

kztk-m commented 6 months ago

Are you using flippre regularly?

To be honest, no. One reason is that there is not so much opportunity to write parsers/printers, especially because I recently focused on embedded DSLs.

For asymmetry of printing I have added Reader and State to the printer monad and ensure that the parser can handle all the variations.

Sounds interesting. Where can I find out in the repo how these monads are used in printing?

BebeSparkelSparkel commented 6 months ago

An example of it in use https://github.com/BebeSparkelSparkel/biparsing/blob/0f60850822a0dfd6c11afc5804c957fcb15511c6/examples/WriterState.hs#L80

Currently doing a lot of house keeping but right now it is in

https://github.com/BebeSparkelSparkel/biparsing/blob/c9b15449ad8fff4f873b26b03b015a9c158f33a8/biparsing-core/src/Biparse/Biparser/StateReaderWriter.hs#L30

An instance of BackwardC https://github.com/BebeSparkelSparkel/biparsing/blob/c9b15449ad8fff4f873b26b03b015a9c158f33a8/biparsing-mixes/src/Prelude.hs#L54

kztk-m commented 6 months ago

Thank you. I will take a look. Sorry for the late reply.