haskell-hvr / regex-tdfa

Pure Haskell Tagged DFA Backend for "Text.Regex" (regex-base)
http://hackage.haskell.org/package/regex-tdfa
Other
36 stars 9 forks source link

how to best address a need for lookarounds? #61

Open pmiam opened 1 week ago

pmiam commented 1 week ago

I am a user of the hledger tool. For some time my user experience has been limited by the fact that regex-tdfa does not support the negative lookahead. My goal is to add lookaround support to hledger's query engine, but I need some advice to help me get started:

Are lookarounds welcome in regex-tdfa? If so, I will contribute here.

There is a lot of homework I have yet to do on this subject. If my instincts are wrong, I'd appreciate a forewarning. Thank you.

andreasabel commented 1 week ago

Hi @pmiam, thanks for your interest. So, the story here is that this package does not have an active maintainer. I maintain it to the extend to keep it buildable with newer GHCs and newer versions of libraries it depends on. I don't develop it further, and my main interest is to keep it working so that nothing breaks.

Larger work on the code always brings the risks of introducing regressions. This package has a testsuite, but I have not tried to investigate how complete it is and how likely it catches regressions.
Besides the written testsuite, there is evidence for the correctness of the package by test-of-time: it has been around for long and used by a fair number of clients and has worked ok.

Are lookarounds welcome in regex-tdfa? If so, I will contribute here.

  • I understand lookarounds are not POSIX standard, but it seems POSIX purity is not a stated goal

Extensions do not conflict with my stated goal of stability, as long as they are backward compatible. They would have to be backed by a strong testsuite though, testing all the possible variants of the feature, also in combination with the existing features. (A new feature might conflict with any of the existing features.)

  • lookarounds appear to be possible in DFA, but I may easily be wrong

So I suggest you work on a fork of this repo, so you can figure out whether its feasible. If stuff works, there still are the options to merge it in here or release it as a separate package. It is probably too early now to decide this.

pmiam commented 1 week ago

Thank you for your optimistic response, Andreas. I have started a fork.

This will be a big undertaking for me, but I think worthwhile. I will work independently, but I may ask some conceptual questions here.

Of course, I welcome input from other interested devs on this issue or on my fork.