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

Adding ZStreamChunk#Collect #1379

Merged
merged 3 commits into from Aug 11, 2019
Merged

Adding ZStreamChunk#Collect #1379

merged 3 commits into from Aug 11, 2019

Conversation

shankarshastri
Copy link
Contributor

Fixes #1352

ZStreamChunk(new ZStream[R, E, Chunk[B]] {
override def fold[R1 <: R, E1 >: E, B1 >: Chunk[B], S]: Fold[R1, E1, B1, S] =
ZManaged.succeedLazy { (s, cont, f) =>
self.fold[R1, E1, A, S].flatMap { fold =>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would unfortunately destroy the chunk structure. Could you try rewriting it with self.chunks.fold and running collect(p) on each chunk?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ZStreamChunk(self.chunks.map(e => e.collect(p)), @iravid any thoughts about this one?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that'd be nice and short!

@shankarshastri
Copy link
Contributor Author

@iravid , Please take a look at it once, and let me know if you have any concern.

Copy link
Member

@iravid iravid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Could you just move the method definition to be before dropWhile so that the alphabetical ordering is retained?

@shankarshastri
Copy link
Contributor Author

Sure, fixed the same.

Copy link
Member

@iravid iravid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @shankarshastri!

@iravid iravid merged commit d53f6ac into zio:master Aug 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add ZStreamChunk#collect
2 participants