-
-
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
contravariant coyoneda #2150
contravariant coyoneda #2150
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2150 +/- ##
==========================================
+ Coverage 94.67% 94.71% +0.03%
==========================================
Files 328 329 +1
Lines 5536 5558 +22
Branches 199 214 +15
==========================================
+ Hits 5241 5264 +23
+ Misses 295 294 -1
Continue to review full report at Codecov.
|
} | ||
|
||
/** `ContravariantCoyoneda[F, ?]` provides a conntravariant functor for any `F`. */ | ||
implicit def catsFreeCovariantFunctorForCovariantCoyoneda[F[_]]: Contravariant[ContravariantCoyoneda[F, ?]] = |
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.
Should be Contravariant
here
01661de
to
46d54dc
Compare
final def run(implicit F: Contravariant[F]): F[A] = F.contramap(fi)(k) | ||
|
||
/** Converts to `G[A]` given that `G` is a contravariant functor */ | ||
final def foldMap[G[_]](trans: F ~> G)(implicit G: Contravariant[G]): G[A] = |
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 add a test for this one as well?
@tpolecat would you like to bring this one into the upcoming 1.1 release? |
Yeah I'll try to do that test this morning. |
I added a kind of lame test that exercises |
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.
Code LGTM, although I am not very familiar with the subject. It would be great if we can get 2 more reviews.
@iravid any other feedback on this one? |
I'm very similar to Kai, the code looks very much okay to me, but I don't quite grasp the use cases, so if we could get one other review, maybe that'd be best. |
As a practical matter the main use case is factoring out the boilerplate of writing a [stack-safe] contravariant functor. Simple example here. |
This is mostly a copy/paste job from
Coyoneda
with the arrows flipped.