-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add LowerBounded and UpperBounded type classes #2910
Conversation
This is a great PR, thank you so much! I think we could add a bunch more instances, if you're up to it :)
|
I can also see another problem. What happens if someone summons both def foo[A: Order: Bound](x: A, y: A) = x === y The above will probably result in ambiguity. trait LowerBound[A] {
def lowerBound: A
def partialOrder: PartialOrder[A]
} |
@LukaJCB Thanks for pointing out the ambiguity issue!
Yes, I'm definitely up to it! I just wasn't quite sure about boundaries for some types that you enumerated. Can you please help me determine whether my understanding is correct:
|
Codecov Report
@@ Coverage Diff @@
## master #2910 +/- ##
=========================================
+ Coverage 94.24% 94.3% +0.05%
=========================================
Files 363 366 +3
Lines 6951 7020 +69
Branches 184 180 -4
=========================================
+ Hits 6551 6620 +69
Misses 400 400
Continue to review full report at Codecov.
|
That seems inline with what I had in mind, except for:
There is
We have to go with what the existing Does that make it more clear? :) |
@LukaJCB Yes, makes perfect sense to me. Thanks! |
Btw, I don't see instances in |
Durations can be negative. See |
Thanks @rossabaker !
This still satisfies the law, so unless there are any objections I'm going to introduce those as well. UPD: Oops, sorry. My 1st point is completely wrong since I forgot about the scenario when the collection's size is > 1 and the first element equals to the upper bound. Please ignore it. |
TIL, that's kinda weird, though, what kind of duration is -4 minutes? 😄 |
imho a duration is just the difference between two points in time, which of course can be negative. |
I mean, time is a directional vector, not a magnitude. I think |
@LukaJCB I think this PR is ready to be revisited once you get a chance. Thanks |
Thanks so much for this contribution. I think we should avoid adding so many new bincompat traits in the master branch now we are very close to drop support for 2.11 on master. I.e. I am proposing separating this into two PRs,
|
@kailuowang I think the suggested approach sounds reasonable except one thing. I'm not sure I can just add an instance for |
@izeigerman ah I didn't realize that there are instances you can add without bincompat traits. Yes please make them as part of step 1. Thanks!!! |
The PR that covers step 1 is #2913 |
Implements #1536