-
-
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
Binary-compatibly move typelevel/algebra into cats repo #3918
Binary-compatibly move typelevel/algebra into cats repo #3918
Conversation
Brings in Scala 3 final
Partially merges typelevel/algebra#247
Ok everyone, good news: I was able to rework @denisrosset's proposals typelevel/algebra#246 and typelevel/algebra#247 as well as typelevel/algebra#108 so that they are binary compatible 😅 Unfortunately I had issues with 44eb36c which tries to reduce potential for conflicts when using Still haven't brought in any of the significant changes to laws yet, but since it seems breaking bin-compat there could be okay they are less of a concern. |
@denisrosset @larsrh @johnynek @mpilquist Ready for review. Hopefully we can wrap this up? :) I decided not to make any binary-breaking changes to laws, doing so doesn't feel right under semantic versioning. Furthermore, I decided to keep everything in both core/laws source-compatible and added In the end I was able to replay most of the changes from the original PR. The glaring omissions are:
Thanks all! |
I'll look soon. Note: removing "implicit" is actually binary (although not source) compatible. Since source incompatibilities are always discovered by compilation but binary are often discovered via runtime crashes in transitive dependencies, I would consider removing implicits that conflict to be acceptable. |
Thanks, I am aware of this! See my comment above #3918 (comment) about the problems I had with this. I don't think removing |
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'm mostly good. I had a couple of minor comments.
* This type can be useful for problems where multiple algorithms can | ||
* be used, depending on the type classes available. | ||
*/ | ||
@deprecated("No replacement", since = "2.7.0") |
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.
why is this deprecated? It seems it is not deprecated in algebra?
The motivation is that some functions can be written that e.g. use either a Group or a Monoid. If you have a Group, it can be more efficient, or else you can fall back to Monoid (at a constant multiplicative cost).
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.
Note: we could imagine pushing this onto Either[A, B]
in the scala standard library (prefer Right, fallback to Left). Similarly with Option[A]
and tuples, but I think the standard library currently does not allow 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 was just replaying 7ff1809 which was suggested on the original PR since it's not used in algebra itself. My bad, now I see its intrinsic value. I'll bring it back.
Btw I did see your plans to submit it to Scala standard library in typelevel/algebra#67!
fold[Option[F]](_ => None)(f => Some(f)) | ||
} | ||
|
||
@deprecated("No replacement", since = "2.7.0") |
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 we remove this?
@@ -0,0 +1,10 @@ | |||
package algebra.laws.platform | |||
|
|||
private[laws] object Platform { |
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.
since this is private, can we remove this and use:
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 would have liked to, but that one is also private! Since they don't share the same package. Ok to make the cats-kernel
one public?
|DistributiveLattice | ✓| ✓| | | ✓| | | | ||
|BoundedLattice | ✓| ✓| ✓| ✓| | | | | ||
|BoundedDistributiveLattice| ✓| ✓| ✓| ✓| ✓| | | | ||
|Heyting | ✓| ✓| ✓| ✓| ✓| ✓| | |
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 Logic is missing from this table, btw...
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.
If you tell me which boxes to check I'll add it in real quick :) I'm ok with the first 5 columns or so, but a bit confused about the last two.
I remain unconvinced that this one is better than #3877, but will not stand in the way of getting this done. |
Just a polite bump :) does anyone else want to chime in? @denisrosset or @mpilquist? |
Algebra is a part of cats as of typelevel/cats#3918
Following directly from #3877 (comment).
Re-played commits from #3877: