-
Notifications
You must be signed in to change notification settings - Fork 4
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
add rudimentary zio-stream support #113
Conversation
That is awesome! ❤️ Thank you so much, I always wanted zio-stream to be supported. What this PR also shows is that we should really return effect types for the function |
In the long-run, we could think about support the |
I think, it is okay to leave out Subjects. I am not even sure, whether the typeclasses around |
Yes, not returning Supporting environments is a different beast, but I am not sure if we should at all. Especially in outwatch it would require to pass the environment through the entire library using something like cats-mtl's
I do not use any Subjects at all in my own code. I am experimenting with the actor pattern instead, especially zio-actors looks interesting. |
Actually, we are kind of doing this in a PR in outwatch. We make the |
Maybe it would also be possible to wrap the whole But maybe this would be a good point to continue the discussion in gitter since I am also working on a PR that would add 1 type parameter to |
I feel like this won't be as trivial as implementing some unsafe zio stream conversions. trait Sink[F[_], -G[_]] {
def onNext[A](sink: G[A])(value: A): F[Unit]
def onError[A](sink: G[A])(error: Throwable): F[Unit]
} Problem is that this results in the need to add polymorphic |
Yes, kind of. But I would pull the
Thereby trying to reduce the number of times |
This PR has a soft dependency on #126 |
I took the liberty to rebase this PR on the current master in #170. Thank you so much :) |
This is still a work in progress and is missing tests and some implementations. Feedback welcome.
That being said, zio streams don't translate well to a reactive-streams style api. Especially ZSink is kinda dodgy.
Zio streams are completely functionally pure, while reactive streams rely on impure behavior here and there. Especially when subscribing, cancelling and in subjects.
Speaking of which, I have no Idea how I should implement subjects because ZStream and ZSink both are abstract classes and not traits, so they cannot be combined.
This approach currently includes the following type aliases:
These are necessary to pass the type to the type parameter of
Sink
andSource
respectively.I thought this would look a little nicer than using type lambdas.
The
T
inTSink
andTStream
stands forTask
since their static type parameters are identical to zio'stype Task[A] = ZIO[Any, Throwable, A]