-
Notifications
You must be signed in to change notification settings - Fork 346
Correct Min.semigroup #651
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
Conversation
Hmm, build failure seems unrelated to the PR changes. |
Amazing. It looks like the monoid was correct and since all the numeric types use that we were saved. |
property("Max.semigroup returns the maximum item") { | ||
forAll { v: NonEmptyVector[Int] => | ||
val maxItems = v.items.map { Max(_) } | ||
v.sorted.last == Max.semigroup[Int].combineAllOption(maxItems).get.get |
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.
Can you also test this for a custom type that does not have a special instance defined?
Also, scala has .max on Iterable. Can we just use that rather than sorted.last?
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.
Done.
forAll { v: NonEmptyVector[Int] => | ||
val minItems = v.items.map { Min(_) } | ||
v.sorted.head == Min.semigroup[Int].combineAllOption(minItems).get.get | ||
} |
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.
Same comments as above.
Codecov Report
@@ Coverage Diff @@
## develop #651 +/- ##
===========================================
+ Coverage 82.83% 82.89% +0.05%
===========================================
Files 109 109
Lines 5209 5209
Branches 316 316
===========================================
+ Hits 4315 4318 +3
+ Misses 894 891 -3
Continue to review full report at Codecov.
|
👍 will merge when green. |
Thank you for taking the time to send a PR here. |
This was broken in 0.13.2 by me. :( I'm sorry y'all... I just hit this in tests trying to update to the latest algebird. At least our tests caught it.... Will publish 0.13.4 presently. |
Min.semigroup
was incorrectly returning the greater element.This PR corrects the semigroup and adds tests to check the results from both
Min.semigroup
andMax.semigroup
(which was already correct).