-
Notifications
You must be signed in to change notification settings - Fork 8
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
The arguments for startsWith are back-to-front. #1
Comments
Another "standard pattern" in Haskell or PureScript is that the data argument is the last to make composition and chaining with partial application nice: all (startsWith "hello") ["hello world", "hello universe"] So while your point is definitely valid it's not as clear-cut as you make it sound. I prefer the trade-offs the current API makes. |
The all notation could be written as:
Which would still be readable and looks the same in both applications. What would be your approach to removing the reading confusion in the infix invocation of this method? I understand your position, it is valid, but I do think this style is cleaner. |
That's not valid PureScript though. The PS equivalent: In
|
Agree with @kritzcreek: in my mind, the "data argument comes last" pattern is much more useful and well-established than the "infix notation reads like a sentence" pattern. |
@robertmassaioli Thank you for your interest in this library! You are right that unfortunately infix notation does not read like a sentence. However, I am inclined to leave the argument order for I could offer two potential solutions:
Please let me know what you think! |
I realize I'm late to the party, but I exclusively write |
For what it’s worth, I had the issue with this function today as I was expecting the same order as in Haskell with |
Just try and read these two statements:
And:
I would expect the opposite results. It seems to break the standard pattern in Haskell and Purescript whereby the infix notation should read legibly as a sentence.
The text was updated successfully, but these errors were encountered: