-
Notifications
You must be signed in to change notification settings - Fork 52
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
Make CLI format format #1459
Merged
Merged
Make CLI format format #1459
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Member
xsebek
commented
Aug 23, 2023
- closes format subcommand is a misnomer #1185
xsebek
commented
Aug 23, 2023
@byorgey once #1464 lands, this could be good to go:
I noticed it drops comments, but we can fix that later. |
Oh, right. Preserving comments will be trickier since right now we just treat them as whitespace and throw them away. https://www.reddit.com/r/haskell/comments/ni4gpm/how_to_retrieve_comments_using_megaparsec/?rdt=59638 is relevant. |
mergify bot
pushed a commit
that referenced
this pull request
Aug 25, 2023
- improve layout of terms: - break lines on binds, unless it fits on one line - lambdas go on same line, but the body _can_ go to next line - def and let can have long body on next line (indented for def) - parens and braces have body indented if it does not fit on line - closes #11 Example using `--format` from #1459: ``` > cabal run swarm -O0 -- format scenarios/Challenges/_blender/patrol-clockwise.sw def forever = \c. c; force forever c end; def encircle = \lDir. \rDir. turn lDir; b <- blocked; if b {turn rDir} {wait 1}; fwBlocked <- blocked; if fwBlocked {turn rDir} {move} end; def patrolCW = force forever (force encircle right left) end; force patrolCW ```
xsebek
force-pushed
the
format-for-real
branch
from
August 26, 2023 08:22
41527ea
to
201a9a7
Compare
Rebased and ready to go! 🙂 |
This was referenced Aug 26, 2023
Merged
byorgey
approved these changes
Aug 26, 2023
xsebek
added
merge me
Trigger the merge process of the Pull request.
CHANGELOG
Once merged, this PR should be highlighted in the changelog for the next release.
labels
Aug 26, 2023
mergify bot
pushed a commit
that referenced
this pull request
Aug 26, 2023
- give lambdas lower precedence (9) then application (10) - closes #1468 Before (with #1459): ``` ❯ cabal run swarm -O0 -- format <(echo '\\m. case m (\\x. x + 1) (\\y. y * 2)') \m. case m \x. x + 1 \y. y * 2 ``` After: ``` ❯ cabal run swarm -O0 -- format <(echo '\\m. case m (\\x. x + 1) (\\y. y * 2)') \m. case m (\x. x + 1) (\y. y * 2) ```
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.