-
-
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
Strong profunctor laws based on category theory #2640
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2640 +/- ##
==========================================
+ Coverage 94.86% 95.13% +0.26%
==========================================
Files 363 363
Lines 6684 6721 +37
Branches 283 290 +7
==========================================
+ Hits 6341 6394 +53
+ Misses 343 327 -16
Continue to review full report at Codecov.
|
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.
very nice, Thanks!
This looks great. Special thanks for documenting the motivation @lemastero! This looks good to me, but I'm a bit surprised that we aren't getting binary compatibility errors since we have removed some public methods from |
@ceedubs, we are not testing BC for An extra incentive to break BC in |
I also agree that breaking binary compatability for correctness like this is acceptable 👍 |
It sounds like I'm a bit more hesitant than @kailuowang and @LukaJCB to break binary compatibility in Lining up versions of scalacheck, discipline and scalatest can already be pretty difficult in a project. I'd hate to add to the complication. |
@ceedubs I agree that breaking BC in cats-laws is not going to be trouble-free. The question is how much trouble and how is that compared to the benefits. I agree that Scalacheck 1.14 is a different story. Since in that case, we are not at the root. |
Thank you for interest in this PR and the insights about BC ❤️
I am working on translating, as much as possible, abstractions from Cheers 🍻 |
@lemastero thanks very much for your contribution. I would definitely love to see profunctors in the cats ecosystem. Cats-core has very rigid BC restricitions at the moment (for good reason) but I don't see why we shouldn't add this as a separate module, and if you want an independent release cycle, it can be external repo like the other cats external modules like cats-mtl, cats-effect, cats-collections etc. |
@ceedubs binary breaking is no longer a concern because the next release is Cats 2.0 which permits breaking changes for cats-laws and cats-testkit |
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 @lemastero! LGTM
Laws for Strong profunctors were defined in here: #246 but were not based on math foundations.
In paper definition 7.1 of Notions of Computation as Monoids Exequiel Rivas and Mauro Jaskelioff specify 3 laws for profunctor strength.
Based on those Edward Kmett added laws in Haskell Profunctor ekmett/profunctors#38 formulated in terms of
first
andsecond
and laws that ensure proper definition of first and secondThose laws were recently added to Scalaz: scalaz/scalaz#2028.
This PR proposition to add replace existing laws with those from CT/Haskell/Scalaz:
Laws that ensure proper definition of
first
andsecond
:Laws for strength of profunctor (expressed using
first
):Above laws for strength of profunctor expressed using
second
:WDYT about such change?