-
-
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 foldMapK, reduceMapK #2292
Add foldMapK, reduceMapK #2292
Conversation
BTW. we could also leave it as it is and use the |
Some binary compat issues on 2.10/2.11 JVM, not sure how to solve |
I am not sure about this one. It seems that a more generic approach would be provide an importable conversion from MonoidK to Monoid, something like implicit def monoidKAlgebra[G[_], A])(implicit ev: MonoidK[G]): Monoid[G[A]] = ev.algebra and then wherever a |
I don't know about others, but I personally don't like implicit functions that aren't converting to extension classes (which is a workaround for no value classes in traits/classes) :) Edit: Wait, this is derivation (the argument is implicit) - so I guess it should be okay :D What do others think? |
I think that particular method doesn't work when a type has different instances for Monoid and MonoidK. Maybe @tpolecat can chime in as he was the one with a use case for it :) |
I just found another usecase for myself, WDYT about moving it to syntax for now (for bincompat) and continuing with it? |
Sounds good to me! :) |
implicit def monoidKAlgebra[G[_], A])(implicit ev: MonoidK[G]): Monoid[G[A]] = ev.algebra @kailuowang @kubukoz I don't think that we want to go down this path, as Edit: just to be clear, I was referring to a previous suggestion of deriving implicit |
It's a fair point that MonoidK and Monoid instance could be different. Let's proceed with adding this to bincompat syntax traits. |
@kubukoz Are you still working on this? :) |
tbh I completely forgot about it. I think I'll start over (especially with all these conflicts) and get something out there soon :) |
Codecov Report
@@ Coverage Diff @@
## master #2292 +/- ##
==========================================
+ Coverage 95.12% 95.13% +<.01%
==========================================
Files 365 365
Lines 6753 6757 +4
Branches 285 286 +1
==========================================
+ Hits 6424 6428 +4
Misses 329 329
Continue to review full report at Codecov.
|
@LukaJCB @kailuowang this one should be ready when the build is green :) sorry for the long wait btw. the "Binary Breaking" label isn't relevant anymore |
Rebased to resolve conflicts after #2671 |
Looks about green :) @LukaJCB |
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.
Thanks!
ping @kailuowang |
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.
Lgtm, sorry about the delay
Closes #2275.
Not sure if we need to forward the target effect parameter of these functions in all the test classes, or whether we can just use
Id
or some other hardcoded type having aMonoidK
, but for now I added appropriate implicits etc. everywhere.