Skip to content

Conversation

@TauOmicronMu
Copy link
Collaborator

Closes #278

Think this reads alright :)

Copy link
Collaborator

@BinderDavid BinderDavid left a 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.

Copy link
Contributor

@david-christiansen david-christiansen left a 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.

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.
Copy link
Contributor

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.

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

Copy link
Collaborator Author

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.

Copy link
Contributor

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.
Copy link
Contributor

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.

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

@david-christiansen
Copy link
Contributor

Looks like we had a review race condition!

@david-christiansen
Copy link
Contributor

@BinderDavid I'll let you approve before a merge

@TauOmicronMu TauOmicronMu requested a review from BinderDavid June 11, 2023 10:46
@BinderDavid BinderDavid merged commit 94e03ad into haskellfoundation:main Jun 11, 2023
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.

PsErrArrowExprInPat -> 4584

3 participants