-
Notifications
You must be signed in to change notification settings - Fork 521
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
CoflatMap for Sync #100
CoflatMap for Sync #100
Conversation
Codecov Report
@@ Coverage Diff @@
## master #100 +/- ##
==========================================
+ Coverage 88.44% 88.47% +0.02%
==========================================
Files 20 20
Lines 450 451 +1
Branches 40 41 +1
==========================================
+ Hits 398 399 +1
Misses 52 52 |
This passes the tests, but I'm concerned that the reason for this cats-core concern being in cats-effect is "we thought of it 48 hours too late for it to be in cats-core." An alternative proposal. This compiles and passes MiMa in cats-core: object CoflatMap {
implicit def catsCoflatMapFromApplicative[F[_]](implicit F: Applicative[F]): CoflatMap[F] =
new CoflatMap[F] {
def coflatMap[A, B](fa: F[A])(f: F[A] => B): F[B] = F.pure(f(fa))
def map[A, B](fa: F[A])(f: A => B): F[B] = F.map(fa)(f)
}
} And then: trait Foo[_]
object Foo {
implicit val catsApplicativeForIO: Applicative[Foo] = null
}
object TestResolution {
implicitly[CoflatMap[Foo]]
} That would miss cats-1.0, but wouldn't have to wait for cats-2.0. I don't know what ambiguous instance havoc this might unleash, but it works for me so far. |
I'm not a hundred percent sure this is a cats-core concern. I view this the same way as I do I can't say for certain if |
As long as |
I say it's a cats-core concern because I think the only reason we're talking about this in cats-effect was because it was too late to do anything deeper in cats-core. There's no extended property of I think @LukaJCB hits on the key question: do we want this derivation to be implicit or explicit? I think the If it should be explicit, then what we have now in cats-core is good. If it should be implicit, then I'd like to first rule out putting it on the |
This would also prevent a default |
Prevents a default, forking |
Yep |
If it requires an execution context to do the above actions is it the same |
The |
My primary use case was based on |
Existing
Existing
Some of these differences are very subtle, but they're all there. As for defining |
I think I found a reason not to use the applicative one in the least.
|
I think this should not delay a release I would like to work to get an implicit implemented for next week or if I can beat the bus. I am going to see how this can be worked in meaningfully in several places. |
Precedent: the |
Fixes #97
Extends CoFlatMap and uses methods directly as that was only way that was inserting methods. I'd be interested in a better approach.