-
-
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 Semigroup and Monoid combinators reverse and intercalate #3279
Conversation
Looks like some annoying 2.13 deprecation warnings. But once those are cleaned up I'm 👍 on this! |
actually, |
also @kubukoz correctly pointed out if we test associativity of combine, we don't need to test associativity of reverse.combine or intercalate.combine after we check that they are actually reversing or intercalating because the fact they are associative is true for all associative combines:
so I removed those associativity checks after we check that reverse and intercalate are actually doing reverse and intercalate. |
Codecov Report
@@ Coverage Diff @@
## master #3279 +/- ##
==========================================
- Coverage 93.14% 93.07% -0.08%
==========================================
Files 378 378
Lines 7576 7628 +52
Branches 203 206 +3
==========================================
+ Hits 7057 7100 +43
- Misses 519 528 +9
Continue to review full report at Codecov.
|
looks like BigDecimal isn't really commutative in 2.13
|
…ch fails for almost commutative BigDecimal
trait CommutativeMonoid[@sp(Int, Long, Float, Double) A] extends Any with Monoid[A] with CommutativeSemigroup[A] | ||
trait CommutativeMonoid[@sp(Int, Long, Float, Double) A] extends Any with Monoid[A] with CommutativeSemigroup[A] { | ||
self => | ||
override def reverse: CommutativeMonoid[A] = self |
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.
Minor nit, but why not just use this
?
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.
I think we can go ahead and merge this now and reinstate the intercalate
optimization in a follow-up if that's agreeable to everyone.
I never know who has authority to merge things here. It seems people approve but don’t merge. I think it creates a bad experience for contributors. I think technically I have the merge bit so I could have clicked merge but culturally I think active maintainers should be the ones making the calls wrt release schedules etc... |
@johnynek I was planning to merge but wanted to give you a day or two to follow up on the question about the |
@johnynek (For the record though I don't think anyone would have looked sideways if you'd merged it yourself after the second checkmark—I definitely wouldn't have.) |
This adds a few things: