-
-
Notifications
You must be signed in to change notification settings - Fork 95
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
ord: add comparison functions #239
Conversation
What about ramda/ramda#1497? |
It seems to me there's no perfect solution to this problem. I've wavered, but my current position is that the placeholder is the best of several compromises. |
60e1e4b
to
d354d66
Compare
Personally I agree with what you wrote at the top of the thread
I've argued along those same lines when it has come up before on ramda. I honestly never use these functions except when curried. Would be curious to hear what others think.. |
Pinging @Avaq, @JAForbes, and @scott-christopher for input. I'm in two minds, but not including these functions in the library just because there's no unequivocally correct argument order seems unreasonable. I'm happy to make |
I think I have always been on the side of wanting these to be thought of as unary functions that return predicates in Ramda, so I would be in favour of |
I'm very much in favour of |
Are these then unary functions? That's always been one possibility for Ramda. // gt :: Ord a => a -> (a -> Bool) If they're binary like Ramda's // gt :: Ord a => a -> a -> Bool then I think there is equally surprising behavior when these are fully applied. Many users are sure to be confused by |
4731e78
to
4e05391
Compare
cfae47a
to
fce501d
Compare
fce501d
to
8ed34ea
Compare
8ed34ea
to
ba9c94b
Compare
ba9c94b
to
d6b3822
Compare
c190574
to
61f23fb
Compare
Thanks for even bringing this up - I always felt Ramda's were backwards. I want to be able to do |
@CrossEye has made a strong case for ramda's behaviour on gitter. I still find myself sighing aloud whenever I reach for these functions and need to use the placeholder, or an arrow function But I see value in thinking of these functions as language operators. Recently I've been programming build scripts in livescript with infix syntax, and it makes me thankful for ramda's design in those contexts. I imagine there's plenty of scenarios where retaining an operator inspired api would pay off, and I think I'm just not as good of a programmer as @CrossEye so I've simply not encountered them yet. If these functions aren't treated as operators, then other functions like I think I'd be in favour of Context matters, in the context of a library like sanctuary, I think consistency is pivotal. So I'm at the very least changing my vote to "wavering" like @davidchambers, mostly due to @CrossEye's reasoning. |
@JAForbes It's funny you mention let append123 = S.concat(S.__, [1,2,3]);
// vs
append123 = S.concat([1,2,3]); This just may be my bias and not necessarily representative of a community. But to the point, consistency would require changing I agree w/ @tycho01 in ramda/ramda#1497 (comment) |
61f23fb
to
7d49167
Compare
I've updated this pull request. It now introduces eight functions:
Although all eight functions are binary, the unsuffixed ones can be considered unary. If we decide to merge this pull request we should first update existing binary functions accordingly. What do you think of |
The difference being, @tycho01, that Sanctuary currently does use the |
Fair enough. :) |
Maybe prefix the underscore (ie |
I see the two uses as related:
Even if one considers the above a stretch, the |
ha! Alright, if you want to include them, suffix seems okay to me 👍 |
Hey, why not go for |
What about |
I'll close this pull request, as fantasyland/fantasy-land#235 will soon deliver something better. :) |
I have an updated proposal in #391 (comment) inspired by Haskell's infix operator sections. |
These functions should be uncontentious.