Composes two pipelines into one pipeline, by first applying the transformation of the specified pipeline, and then applying the transformation of this pipeline.
Compose this transducer with a sink, resulting in a sink that processes elements by piping them through this transducer and piping the results into the sink.
Composes two pipelines into one pipeline, by first applying the transformation of this pipeline, and then applying the transformation of the specified pipeline.
A named version of the >>>
operator.
Attach this pipeline to the given stream
A named version of the <<<
operator.
Transforms the errors emitted by this pipeline using f
.
A more powerful version of mapError which also surfaces the Cause of the channel failure
Translates pipeline failure into death of the fiber, making all failures unchecked and not a part of the type of the effect.
Keeps none of the errors, and terminates the fiber with them, using the
specified function to convert the E
into a Throwable
.
Converts this pipeline to its underlying channel
A
ZPipeline[Env, Err, In, Out]
is a polymorphic stream transformer. Pipelines accept a stream as input, and return the transformed stream as output.Pipelines can be thought of as a recipe for calling a bunch of methods on a source stream, to yield a new (transformed) stream. A nice mental model is the following type alias:
This encoding of a pipeline with a type alias is not used because it does not infer well. In its place, this trait captures the polymorphism inherent to many pipelines, which can therefore be more flexible about the environment and error types of the streams they transform.
There is no fundamental requirement for pipelines to exist, because everything pipelines do can be done directly on a stream. However, because pipelines separate the stream transformation from the source stream itself, it becomes possible to abstract over stream transformations at the level of values, creating, storing, and passing around reusable transformation pipelines that can be applied to many different streams.
The most common way to create a pipeline is to convert a sink into a pipeline (in general, transforming elements of a stream requires the power of a sink). However, the companion object has lots of other pipeline constructors based on the methods of stream.