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 ZStream#partition #1102

Closed
DamianReeves opened this issue Jun 28, 2019 · 4 comments · Fixed by #1387
Closed

Add ZStream#partition #1102

DamianReeves opened this issue Jun 28, 2019 · 4 comments · Fixed by #1387
Labels
enhancement New feature or request stream ZIO Stream

Comments

@DamianReeves
Copy link

DamianReeves commented Jun 28, 2019

Add the following method to ZStream:

def partition[B, C, R1 <: R, E1 >: E](p: A => ZIO[R1, E1, Either[B,C]]): ZManaged[R1, E1, (ZStream[R1, E1,B], ZStream[R1, E1, C])]
@iravid iravid added enhancement New feature or request stream ZIO Stream labels Jun 29, 2019
DamianReeves added a commit to DamianReeves/zio that referenced this issue Jul 3, 2019
@spf3000
Copy link
Contributor

spf3000 commented Jul 3, 2019

@DamianReeves wouldn't split accept a function of p: A => Boolean ? Similar to for example ZStream#filter: def filter(pred: A => Boolean): ZStream[R, E, A] - and then the signature you mentioned could be splitM similar to ZStream#filterM final def filterM[R1 <: R, E1 >: E](pred: A => ZIO[R1, E1, Boolean]): ZStream[R1, E1, A]?

DamianReeves added a commit to DamianReeves/zio that referenced this issue Jul 3, 2019
DamianReeves added a commit to DamianReeves/zio that referenced this issue Jul 3, 2019
@didierd
Copy link
Contributor

didierd commented Jul 7, 2019

What about the more general

def split[B, C, R1 <: R, E1 >: E](p: A => ZIO[R1, E1, Either[B,C]]): ZManaged[R1, E1, (ZStream[R1, E1,B], ZStream[R1, E1, C])] ?

@iravid
Copy link
Member

iravid commented Jul 21, 2019

@didierd I missed this comment - that's a good generalization! We should do that.

@iravid iravid changed the title Add ZStream#split Add ZStream#partition Jul 21, 2019
@vasilmkd
Copy link
Contributor

Is anyone working on this actively?

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

Successfully merging a pull request may close this issue.

5 participants