-
Notifications
You must be signed in to change notification settings - Fork 4
Cats effect 3 #167
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
Cats effect 3 #167
Conversation
6e67451 to
6beb34f
Compare
|
Realistically, people will probably mostly use The methods returning resources are the "correct" implementation for the current interface but feel unergonomic. The methods taking an implicit dispatcher is a pattern i saw in https://github.com/zio/interop-cats. It's just that you normally do not have a dispatcher implicitly - cats effect actively advises against it. Possibly makes sense to have extension methods for specific libraries like zio or monix to make it work better. |
6beb34f to
3907576
Compare
|
Another question: should we just use |
88b3b25 to
f7b9ab2
Compare
f7b9ab2 to
77139a2
Compare
77139a2 to
9428663
Compare
|
If you have an |
c5f4414 to
b6d5c93
Compare
a0e57d9 to
c6ec72f
Compare
This is the best I could come up with for cats-effect 3 without totally rewriting the whole Observable interface.
I think, a potentially cleaner approach would be to move the effect type into the Observable trait like
Observable[F[_], A]. But that has other disadvantages - it becomes difficult to mix different effect types and it adds noise by introducing a type parameter everywhere.Changes
Functions like
fromAsync[F[_]],mapAsync[F[_]], etc. do not just need anEffect[F]instance, but actually need aDispatcher[F]orIORuntimenow. Therefore, we have invented our own replacement unlawful typeclass for effect:RunEffectandRunSyncEffect(this is similar to what scalajs-react does). Coming with instances forIOandSyncIO. You can also create one forAsyncor with aDispatcher. Also adding a module for zioTasksupport.fromEffect[F[_]],mapEffect[F[_]]which takes aRunEffectF]implicitlyThereby
fromSync[F[_]]andmapSync[F[_]]are also deprecated in favor offromEffect/mapEffect.Furthermore, we have renamed all side-effecting functions like
subscribe,onNext,onError,canceltounsafeSubscribe,unsafeOnNext,unsafeOnErrorandunsafeCancel. I know, the names are not that beautiful, but I want to make sure that users know that these method actually are a side-effect. The old ones are now deprecated. There also now exist referential transparent versions of these:subscribeF[F[_]:Sync],subscribeIO,subscribeSyncIOand so on.We had to drop support for monix for now, because it does not support cats-effect 3 yet. I have commented it out for now.
I also took the liberty to remove the types
CreateSubject,CreateProSubject. The only use-case was with monix in outwatch and will now be removed.Feedback is welcome! @TobiasRoland @fdietze What do you think?
Fixes #165
Fixes #5