-
Notifications
You must be signed in to change notification settings - Fork 134
Add support for --no-comments to spago init #428
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
Conversation
f-f
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jhrcek sorry for taking a while to review. This looks great!
I only left minor comments, but we're almost there 🙂
|
Thanks for the feedback! spago works great and is really useful. Also the source code is nicely readable. I'd like to contribute some more to practice my Haskell :-) Let me know if there are some issues that you'd consider helpful to fix, otherwise I'll pick something with "good first issue" label |
|
@jhrcek thanks for the kind words, I'm happy to hear this 😊 I just went through all the issues marked with "good first issue", and they should all be fine to pick up! I also tried to provide context and/or an idea for implementation in there, but if there are any details missing or confusing I'd be happy to detail more in the relevant threads 🙂 |
f-f
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks for doing this! 👏
Description of the change
Here's the initial attempt to implement support for
--no-commentsswitch (fix #417)The most future-proof approach seems to be to parse the dhall template file, remove comments from AST and pretty-print it before writing the file. This however is currently not possible due to dhall stripping most comments while parsing (see dhall-lang/dhall-haskell#145).
This PR could be considered a hack taking advantage of this Dhall behavior and simply does parse + pretty print of dhall templates, which "accidentally" strips comments. This impl. will potentially break in the future when Dhall parser preserves comments, but I added tests to catch this.
I thought of couple of alternative approaches, but I find them even more hacky/brittle than the current PR:
Text.dropWhile (/="-}")on the dhall template files (would break once more than 1 comment is present in the template or comment is somewhere else than in the beginning)Checklist:
READMEP.S.: the above checks are not compulsory to get a change merged, so you may skip them. However, taking care of them will result in less work for the maintainers and will be much appreciated 😊