-
-
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
Move arbitrary instance of StateT to laws #1584
Move arbitrary instance of StateT to laws #1584
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1584 +/- ##
==========================================
+ Coverage 92.4% 93.11% +0.71%
==========================================
Files 248 250 +2
Lines 3961 3992 +31
Branches 140 136 -4
==========================================
+ Hits 3660 3717 +57
+ Misses 301 275 -26
Continue to review full report at Codecov.
|
As we are providing |
good catch @peterneyens , added. |
I added an |
@kailuowang I'm hesitant to add it without any tests that use it. Especially because this is the sort of thing that can easily lead to ambiguous instances. I'd be inclined to add a test and even see if we could get by without the instances that are specific to On a separate note, our instances for function-like types like |
I think that this resolves typelevel#1605. It may have merge conflicts with typelevel#1584 and I think that one should probably be merged first. I noticed a slight discrepancy between how I've implemented this (taking implicit `Cogen` and `Arbitrary` instances) vs how the current `StateT` arbitrary instance works (it takes an implicit `Arbitrary[S => F[(S, A)]]]). I'm not really sure whether one approach is better than the other. We should probably align on one of the two, though.
… Reader is covered
@ceedubs I added a test for |
@@ -15,6 +15,9 @@ class KleisliTests extends CatsSuite { | |||
implicit def kleisliEq[F[_], A, B](implicit A: Arbitrary[A], FB: Eq[F[B]]): Eq[Kleisli[F, A, B]] = | |||
Eq.by[Kleisli[F, A, B], A => F[B]](_.run) | |||
|
|||
implicit def readerEq[A, B](implicit A: Arbitrary[A], FB: Eq[Id[B]]): Eq[Reader[A, B]] = | |||
Eq.by[Reader[A, B], A => Id[B]](_.run) |
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, but this could probably just delegate to the kleisliEq
couldn't it?
@peterneyens do you want to take another look after the most recent changes? |
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 about to add a similar Reader
test in #1618.
This should be the only data type missing
Arbitrary
instance in laws.fixes #1274