-
Notifications
You must be signed in to change notification settings - Fork 604
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
Implement unchunks
(inverse of chunks
)
#2506
Conversation
There's already |
chunks
(inverse of unchunks
)unchunks
(inverse of chunks
)
The only concern I see is the fact that |
If this is true, can we deprecate and rename |
I'd be fine with deprecating |
It's a very obtuse method actually, because the change is happening under-the-hood right? What are its use cases? I would guess maybe when you don't want eager evaluation, so you don't lose a whole chunk on error? Could the name reflect something about that? |
Yeah I've used O.G. |
Another idea: if the OG I think this makes it even clearer exactly what is going on. |
This is superb. |
With current implementation of |
@mpilquist excuse my density, what exactly is the difference? |
The special casing which avoids the cons call when chunk size is equal to 1 |
I still don't see how that makes a difference, other than performance? Since |
Only performance, though if full expansion is literally only the call to cons and doesn't actually change anything, then disregard |
The special case avoids the |
But btw, how important is performance here anyway? In @djspiewak's use-case if the stream is about to get slammed by flatMapping to big chunks does this really matter? |
@@ -2588,6 +2588,7 @@ final class Stream[+F[_], +O] private[fs2] (private[fs2] val underlying: Pull[F, | |||
* res0: List[Chunk[Int]] = List(Chunk(1), Chunk(2), Chunk(3), Chunk(4), Chunk(5), Chunk(6)) | |||
* }}} | |||
*/ | |||
@deprecated("Use .chunkLimit(1).unchunks instead.", "3.0.7") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should have introduced a bunch of deprecation warnings in the test suite. Can we address those too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've wanted this since Segment was still a thing
This seemed a strange omission to me, but maybe there's a good reason for it?