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

Refactor config file & custom rewrites #225

Merged
merged 8 commits into from
Nov 27, 2023
Merged

Refactor config file & custom rewrites #225

merged 8 commits into from
Nov 27, 2023

Conversation

flupe
Copy link
Contributor

@flupe flupe commented Nov 11, 2023

Been looking at more of the source code to try and understand what's going on before I start implementing the enhancements mentioned earlier.

I had missed the fact that we now have support of custom user rewrites. The code seemed very hard to maintain so I went ahead and simplified the parsing of config files (now depending on yaml and aeson, the latter already being a dependency of Agda).

I changed the flag --rewrite-rules to --config as it appears the file already contains more than rewrite rules (e.g: prelude import options). And it's likely we will use the config for more.

The config isn't parsed using unsafeIO anymore when parsing CLI options, but rather fetched safely using the preCompile hook of the backend.

Still need to update the documentation.

@flupe flupe marked this pull request as ready for review November 13, 2023 13:23
@flupe
Copy link
Contributor Author

flupe commented Nov 13, 2023

Done with this first refactor. Feedback welcome. We don't have tests for config files yet but I won't make it part of this PR.

All commits more or less self-standing and passing tests.

Copy link
Member

@jespercockx jespercockx left a comment

Choose a reason for hiding this comment

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

This looks great to me, thanks!

RecordWildCards
FlexibleContexts
MultiWayIf
TupleSections
Copy link
Member

Choose a reason for hiding this comment

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

Oh wow, you can skip the commas? TIL.

Copy link
Contributor Author

@flupe flupe Nov 13, 2023

Choose a reason for hiding this comment

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

Yes! The syntax is surprisingly flexible (unfortunately, probably), though the documentation seems incorrect. I tried trailing commas for build-depends and it wasn't allowed.

@flupe flupe merged commit e4bca58 into agda:master Nov 27, 2023
@jespercockx jespercockx added this to the 1.2 milestone Nov 27, 2023
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.

2 participants