-
Notifications
You must be signed in to change notification settings - Fork 70
Add docs for GHC-04584 #423
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
Conversation
BinderDavid
left a comment
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.
Looks very good :) I think there are just 2 remaining small changes in capitalization.
david-christiansen
left a comment
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.
There's a general style thing to make it consistent with the rest of the docs. The example is really well-chosen.
This reverts commit 5fb1c4e.
| introduced: 9.6.1 | ||
| --- | ||
|
|
||
| Pattern matching allows constructors and literals to be used to take apart values, exposing their contents. The syntax of patterns is very similar to that of the expressions that create values, but many constructs that are allowed in expression contexts are not meaningful patterns. |
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.
Here, I'd use a more specific text for this specific variation.
| Pattern matching allows constructors and literals to be used to take apart values, exposing their contents. The syntax of patterns is very similar to that of the expressions that create values, but many constructs that are allowed in expression contexts are not meaningful patterns. | |
| [Tuple sections](https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/tuple_sections.html) are a concise syntax for functions that result in tuples. The missing expressions in the tuple become arguments to the function. Because tuple sections always result in functions, and functions cannot be matched in patterns, tuple sections are not allowed in patterns. |
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.
Have removed the GHC-09646 stuff from this PR and put it onto a new branch - didn't mean for it to come through here. I'll make the requested changes before sending the new PR over though.
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.
Thanks!
| title: Using tuple section in pattern | ||
| --- | ||
|
|
||
| When pattern matching, tuple sections are not allowed as patterns to be matched against. In the example below, we can fix this by adding the wildcard _ to match on the first element of the pair. |
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 would explain the intent behind the example more. E.g.
| When pattern matching, tuple sections are not allowed as patterns to be matched against. In the example below, we can fix this by adding the wildcard _ to match on the first element of the pair. | |
| When pattern matching, tuple sections are not allowed as patterns to be matched against. In the example below, one of the components of a tuple pattern was forgotten. We can fix this by adding the wildcard _ to match on the first element of the pair. |
|
Looks like we had a review race condition! |
|
@BinderDavid I'll let you approve before a merge |
Closes #278
Think this reads alright :)