Skip to content
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 a combinator for parallel composition of sinks #1310

Closed
iravid opened this issue Aug 1, 2019 · 5 comments
Closed

Add a combinator for parallel composition of sinks #1310

iravid opened this issue Aug 1, 2019 · 5 comments
Labels
enhancement New feature or request stream ZIO Stream

Comments

@iravid
Copy link
Member

iravid commented Aug 1, 2019

No description provided.

@iravid iravid added enhancement New feature or request stream ZIO Stream labels Aug 1, 2019
@iravid
Copy link
Member Author

iravid commented Aug 1, 2019

cc @simpadjo

@simpadjo
Copy link
Contributor

simpadjo commented Aug 1, 2019

Thank you, it would be very useful.

@jdegoes

The reason that probably doesn't exist now is because it's not obvious what to do with leftovers: each sink will, in general, have a different amount of leftover; and the leftovers will overlap. So in their composition, what do you do? Probably emit the shortest. All to say, possible but tricky to do correctly.

I had the same question in my head initially. Now I think that returning the shortest one looks pretty much consistent with respect to ZIIO#zipPar behavior. If a Stream is a timeline and Sinks are processes then ZSink#zipPar considered done at the latest point. Dual to ZSink#raceBoth.

@jdegoes
Copy link
Member

jdegoes commented Aug 1, 2019

I do think shortest is the best ("minimal leftover").

Albeit there will be some nice laws that it can't satisfy.

It'd be nice if you could take sink1 -> sink2 and sink3 -> sink4 and zipPar sink1 and sink3, and then zipPar sink2 and sink4, and then do (sink1 zipPar sink3) -> (sink2 zipPar sink4) and have that give you the same result. But Sink appears not to have the structure required to allow that, because it would require tuple leftovers and tuple inputs.

@simpadjo
Copy link
Contributor

simpadjo commented Aug 1, 2019

I'd like to try to implement it

@iravid
Copy link
Member Author

iravid commented Aug 7, 2019

Closed in #1344

@iravid iravid closed this as completed Aug 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request stream ZIO Stream
Projects
None yet
Development

No branches or pull requests

3 participants