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.
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.
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 |
kailuowang
left a comment
There was a problem hiding this comment.
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
Coyonedawith the arrows flipped.