- Notifications
You must be signed in to change notification settings - Fork298
Add more examples for anonymous argument error#369
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:master
Are you sure you want to change the base?
Conversation
| ```purescript | ||
| module Example where | ||
| add =(_ + _) |
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.
Thisadd example is problematic because:
- Not ideal to overwrite Prelude functions, while also using the corresponding infix operator.
- Even with a different name, it's trivially replaced with
addor(+). - Unclear whether the intention in the broken case is to reuse the same anonymous arg, or consider these separate args. And if separate args, is the expectation that they are populated in order?
| add =(_ + _) | ||
| sub3 =_ - 3 | ||
| mapArray = map _ [1, 2, 3] |
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 think this second-order example adds another layer of potential confusion for beginners. I changed all thesemap examples to use first-order arguments for_.
JordanMartinez commentedDec 18, 2022
This PR hasn't been merged because I'm not sure if the new content is actually correct. There's some release notes in PureScript that clarify this further. |
Also modified the original examples to make them closer to what you'd find in real-world code.
I think this would be clearer if we split this up into multiple Example/Cause/Fix sections. Don't know if that deviation from the common format is allowed.