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

Replace cabal project parsing with Parsec #8889

Draft
wants to merge 76 commits into
base: master
Choose a base branch
from

Conversation

jgotoh
Copy link
Member

@jgotoh jgotoh commented Apr 1, 2023

Implements #6101

Please include the following checklist in your PR:

Please also shortly describe how you tested your change. Bonus points for added tests!

This is a really early version to gather some feedback and to check whether I am on the right track.
I created the rough module structure and a draft of the parser with still lots of holes.
My next steps will be the definition of the FieldGrammar and Lens for ProjectConfigs, afterwards I want to add lots of tests for it.
There are some open questions in the source code that I am really unsure of, I will create some comments after I have created the PR.

@jgotoh
Copy link
Member Author

jgotoh commented Apr 1, 2023

@ulysses4ever as announced, here is an early PR of the changes. Still lots of work, but I have a rough outline of the ticket. I would be glad if you would take a look!

@ulysses4ever
Copy link
Collaborator

Thanks @jgotoh ! Will take a look eventually.

@gbaz you know this code better than anyone currently active, i think. Would you be able to provide guidance?

@jgotoh jgotoh force-pushed the parse-cabal-project-parsec branch 2 times, most recently from 64a2545 to ed3b177 Compare April 2, 2023 07:09
@jgotoh jgotoh force-pushed the parse-cabal-project-parsec branch from ed3b177 to 66a94a8 Compare April 2, 2023 07:49
@jgotoh jgotoh force-pushed the parse-cabal-project-parsec branch from 9ea3fc6 to 402f607 Compare April 3, 2023 06:55
@jgotoh jgotoh force-pushed the parse-cabal-project-parsec branch from 402f607 to 9016a3a Compare April 3, 2023 06:55
@ulysses4ever
Copy link
Collaborator

@grayjay I know you’re more of a solver person, but if you happen to have some time for advising and feel comfortable in this part of the code, your contribution would be priceless.

@ulysses4ever
Copy link
Collaborator

@jgotoh there's a bi-weekly cabal devs meeting, where, I am sure, people would be delighted to hear your experience so far. The closest one is this Thursday (Apr 20th), 1 PM Eastern Time (US). The link to a Jitsi video call is posted before the meeting on #hackage at libera.chat (can be browsed using Element/Matrix or an IRC client). Are you interested?

@jgotoh
Copy link
Member Author

jgotoh commented Apr 19, 2023

@ulysses4ever Thank you very much for you invitation! I've already wondered about the cabal devs main communication channel. I am definitely interested and will be glad to attend :)

@ulysses4ever
Copy link
Collaborator

@jgotoh cool! let me know if you want me to mail you the jitsi link beforehand.

@grayjay
Copy link
Collaborator

grayjay commented Apr 20, 2023

@grayjay I know you’re more of a solver person, but if you happen to have some time for advising and feel comfortable in this part of the code, your contribution would be priceless.

I'm not familiar with this part of the code, but I tried to answer a couple questions based on my understanding of the parser behavior.

Comment on lines +77 to +86
liftPR :: (a -> IO (ParseResult b)) -> ParseResult a -> IO (ParseResult b)
liftPR f pr = unPR pr emptyPRState failure success
where
failure s = return $ PR $ \s' failure' _ -> failure' (concatPRState s s')
success s a = do
pr' <- f a
return $ PR $ \s' failure' success' -> unPR pr' (concatPRState s s') failure' success'
concatPRState (PRState warnings errors version) (PRState warnings' errors' version') =
(PRState (warnings ++ warnings') (toList errors ++ errors') (version <|> version'))

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gbaz I migrated this from Legacy.hs:281 to the new ParseResult. I think you implemented the old version in Legacy.hs? Could you help reviewing this new version? As far as I see it works, but it would be awesome if you would take a look.

@jgotoh jgotoh force-pushed the parse-cabal-project-parsec branch from f449135 to a2e0241 Compare April 2, 2024 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants