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

Add annotations for the main function(s) of every exercises #65

Merged
merged 4 commits into from
Sep 3, 2024

Conversation

ageron
Copy link
Contributor

@ageron ageron commented Sep 2, 2024

This PR adds annotations to the main function(s) of every exercise.

This includes all functions in the main file (e.g., exercises/practice/leap/Leap.roc) and the same functions in the example code (e.g., exercises/practice/leap/.meta/Example.roc) but I did not annotate other functions (yet?).

Also note that in some cases the annotations removed the need for some error test cases: I removed the test cases for negative inputs if the input is annotated as a positive integer like U8 or U64.

Side note: I removed some commented-out code that was meant to show alternative ways of implementing things, because such code often ends up stale, plus the Example.roc file doesn't seem to appear anywhere on the website, it just looks like it's meant to ensure that the test cases work well.

@ageron
Copy link
Contributor Author

ageron commented Sep 2, 2024

There's a debate on Roc's Zulip Chat to decide whether the test cases for expected errors should be minimal (e.g., result |> Result.isErr or whether it should be detailed (e.g., result == Err (QuestionArgHadAnUnknownOperation "What is 52 cubed?")).

Depending on the outcome of this discussion, I might update this PR to make the annotations more or less detailed for errors:

  • Now: answer : Str -> Result I64 [UnknownOperation, SyntaxError]
  • Minimal: answer : Str -> Result I64 _
  • Detailed: answer : Str -> Result I64 [QuestionArgHadAnUnknownOperation Str, QuestionArgHadASyntaxError Str]

I'll also update PR #64 accordingly.

Copy link
Contributor

@isaacvando isaacvando left a comment

Choose a reason for hiding this comment

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

Looks good!

@ageron ageron merged commit 6353c72 into exercism:main Sep 3, 2024
2 checks passed
@ageron ageron deleted the add-annotations branch September 3, 2024 03:53
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