Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Open
milesfrain wants to merge1 commit intopurescript:master
base:master
Choose a base branch
Loading
frommilesfrain:patch-3

Conversation

@milesfrain
Copy link
Contributor

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.

```purescript
module Example where
add =(_ + _)
Copy link
ContributorAuthor

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 withadd or(+).
  • 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]
Copy link
ContributorAuthor

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

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.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@milesfrain@JordanMartinez

[8]ページ先頭

©2009-2025 Movatter.jp