Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to specify multiple components #2

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hasufell
Copy link
Contributor

This doesn't work properly yet.

  • roughAlgorithm works, it's the easiest due to splitAtPositionLine
  • niceAlgorithm doesn't work, it seems my offset logic doesn't play well with splitAtPosition... I wasn't able to figure out why yet
  • fancyAlgorithm: haven't tried yet

My idea was:

  • don't re-parse the cabal file, instead parse and insert "as we go", because usually we only care about a specific line and everything coming after it... so we just need to compute the correct offsets for the next component and then execute the next iteration

An alternative I tried was: using the original cabal file bytestring for each component, then returning position + bytestring-to-insert and combine that in one pass. But here we also need to compute offsets, which is the main difficulty.

@hasufell hasufell marked this pull request as draft October 28, 2023 12:19
@Bodigrim
Copy link
Owner

I have not seen performance bottlenecks with Cabal parser, so I'd keep it simple and just loop in Main.hs over components re-parsing every time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants