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 Elm Analyzer comments for concept exercise ticket-please #2293

Merged
merged 2 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 `_`.
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!
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# destructure assignTicketTo argument

Copy link
Contributor

@ceddlyburge ceddlyburge Nov 7, 2023

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?

Copy link
Contributor Author

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?

Copy link
Contributor

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 ...

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.
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.
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.
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`.
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.
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.
Loading