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

Implement ZPipeline#fromFunction #7789

Merged
merged 2 commits into from
Feb 6, 2023
Merged

Implement ZPipeline#fromFunction #7789

merged 2 commits into from
Feb 6, 2023

Conversation

adamgfraser
Copy link
Contributor

Allows creating a pipeline from a stream transformation function so you can do with a pipeline anything you can do with a stream operator.

@vigoo
Copy link
Contributor

vigoo commented Feb 6, 2023

Feels a bit weird to me doing this if you have only a single ZPipeline.fromFunction applied to the stream (as if it would be a ZStream aspect it could directly transform the stream). But I guess it makes sense if you start composing it with other pipelines.

@adamgfraser
Copy link
Contributor Author

This couldn't be implemented as a stream aspect because it potentially changes the element type.

@vigoo
Copy link
Contributor

vigoo commented Feb 6, 2023

That's right. I just meant that it introduces extra channel components while in theory it could be just applied to the stream when it is "via'd" (or whatever it is called) to the stream. But that does not fit into our current model.

@adamgfraser
Copy link
Contributor Author

Yeah I think the main use case is if you want to represent a stream transformation as a pipeline so it is a first class value and you can compose it with other pipelines. It solves the problem of something being implemented as a stream operator and not a pipeline.

@jdegoes jdegoes merged commit 974c0bd into zio:series/2.x Feb 6, 2023
@adamgfraser adamgfraser deleted the zpipeline branch February 6, 2023 16:13
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.

None yet

3 participants