-
-
Notifications
You must be signed in to change notification settings - Fork 946
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 Elm Analyzer comments for concept exercise ticket-please
#2293
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
analyzer-comments/elm/ticket-please/assignTicketTo_ignore_cases.md
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# assignTicketTo ignore cases | ||
|
||
When there are several `case` patterns that lead to the same value, as happens for the ticket statuses in `assignTicketTo`, it is usual to leave them for last and group them with the wildcard `_`. |
4 changes: 4 additions & 0 deletions
4
analyzer-comments/elm/ticket-please/assignTicketTo_use_record_update.md
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# assignTicketTo use record update | ||
|
||
Once you pattern matched the record from `Ticket` and named it with `as`, the best way to update it is with the [record update syntax](https://elm-lang.org/docs/records#updating-records). | ||
Try it out! |
3 changes: 3 additions & 0 deletions
3
analyzer-comments/elm/ticket-please/destructure_assignTicketTo_argument.md
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# destructure assignTicketTo argument | ||
|
||
Like the instructions mention, please destructure `assignTicketTo`'s argument to extract the record field `status` from the `Ticket` type and use the `as` syntax to name the record. |
3 changes: 3 additions & 0 deletions
3
analyzer-comments/elm/ticket-please/destructure_assignedToDevTeam_argument.md
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# destructure assignedToDevTeam argument | ||
|
||
Like the instructions mention, please destructure `assignedToDevTeam`'s argument to extract the record field `assignedTo` from the `Ticket` type. |
3 changes: 3 additions & 0 deletions
3
analyzer-comments/elm/ticket-please/destructure_assignedToDevTeam_expressions.md
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# destructure assignedToDevTeam expressions | ||
|
||
Like the instructions mention, the `case` statement in `assignedToDevTeam` should pattern match `assignedTo` down to its string content. |
4 changes: 4 additions & 0 deletions
4
analyzer-comments/elm/ticket-please/destructure_emptyComment_argument.md
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# destructure emptyComment argument | ||
|
||
Like the instructions mention, please destructure `emptyComment`'s argument to extract the contents of the tuple. | ||
Ignore the `User` element with the wildcard `_` and keep the `String`. |
3 changes: 3 additions & 0 deletions
3
...yzer-comments/elm/ticket-please/destructure_numberOfCreatorComments_argument.md
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# destructure numberOfCreatorComments argument | ||
|
||
Like the instructions mention, please destructure `numberOfCreatorComments`'s argument to extract the record fields of interest from the `Ticket` type. |
4 changes: 4 additions & 0 deletions
4
...r-comments/elm/ticket-please/destructure_numberOfCreatorComments_expressions.md
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# destructure numberOfCreatorComments expressions | ||
|
||
Like the instructions mention, the `let` statement in `numberOfCreatorComments` should pattern match on `createdBy`, keep the username and ignore the employee ID with the wildcard `_`. | ||
You should also destructure the `List.filter` anonymous function tuple argument in the same way. |
Oops, something went wrong.
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.
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.
This is only tangential, but I don't think there is any reference to the
as
syntax in the concept or exercise docs. I had a google and this cheatsheet was the best source I could find.https://gist.github.com/yang-wei/4f563fbf81ff843e8b1e#record
Maybe we should add it here, and to the exercise and concept docs, what do you think? Or maybe we should create our own documentation for
as
, or open a PR to one of the existing elm documentation sites?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.
We use it in the last example in the introduction of the concept, and we use this link: https://github.com/izdi/elm-cheat-sheet#operators
Both those links are a bit shabby, so I like the idea of contributing to some docs, but which?
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.
I guess we can initially explain it will on exercism, in the concept, where we have full control and can do everything.
Those links are shabby, maybe we could put a shout out on the Elm slack? It's possible that any PR to the main slack won't get merged, but maybe elm-programming or something like that would like it ...