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

avoid numeric vs textual clash in args length error #5192

Merged
merged 2 commits into from
Jul 9, 2024
Merged

Conversation

aryairani
Copy link
Contributor

@aryairani aryairani commented Jul 6, 2024

Overview

image

Implementation notes

Just calls Numerals.us_cardinal instead of show on the number of arguments to be mentioned in the error message.

Interesting/controversial decisions

  • numerals doesn't seem to be maintained anymore, but maybe that doesn't matter

  • "zero" (the default) vs special-casing "none"

Test coverage

I attempted to add additional transcript tests to cover the under-saturated case, but couldn't due to #5190. I would create them as soon as it's possible.

Loose ends

`numerals` doesn't seem to be maintained anymore, however
@aryairani aryairani requested a review from sellout July 8, 2024 14:46
@aryairani aryairani marked this pull request as ready for review July 8, 2024 14:50
Copy link
Contributor

@sellout sellout left a comment

Choose a reason for hiding this comment

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

Ah, wonderful – I had made a note to look into what packages might exist for this. I was hoping for one that was also parameterized on “style” (e.g., 10 -> "ten", but 1023 -> "1,023"), but I don’t think that matters for this use case.

Just one minor suggestion.

unison-cli/src/Unison/CommandLine/InputPatterns.hs Outdated Show resolved Hide resolved
@@ -64,9 +64,14 @@ extra-deps:
- recover-rtti-0.4.2@sha256:c179a303921126d8d782264e14f386c96e54a270df74be002e4c4ec3c8c7aebd,4529
- lsp-2.2.0.0@sha256:82fbf4b69d94d8d22543be71f89986b3e90050032d671fb3de3f8253ea1e5b6f,3550
- lsp-types-2.0.2.0@sha256:a9a51c3cea0726d91fe63fa0670935ee720f7b31bc3f3b33b2483fc538152677,29421
- numerals-0.4.1@sha256:f138b4a0efbde3b3c6cbccb788eff683cb8a5d046f449729712fd174c5ee8a78,11430
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this probably isn’t important to anyone other than me, but I’m never sure exactly which parts of stack.yaml are picked up by haskell.nix. And the nix dev GitHub workflow doesn’t yet actually build Unison, so I’m running nix build github:unisonweb/unison/topic/numerals right now just to make sure it’s all good.

But again, I don’t think nix build should hold up the process for anyone else.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, I forgot to update this – it built fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No problem. Does a passing "Nix development cache" run not indicate success here?

Copy link
Contributor

Choose a reason for hiding this comment

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

No – it currently only builds the dev tools. With the LTS upgrade PR it will build everything.

@aryairani
Copy link
Contributor Author

aryairani commented Jul 9, 2024

1023 -> "1,023"

Lol, I did not consider "I was expecting one thousand twenty three." But yeah I think we are safe in this case.

@aryairani aryairani merged commit 223df40 into trunk Jul 9, 2024
35 checks passed
@aryairani aryairani deleted the topic/numerals branch July 9, 2024 18:24
@neduard neduard mentioned this pull request Jul 12, 2024
1 task
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