Package: effect
Module: Channel
Concatenates this channel with another channel created from the terminal value of this channel. The new channel is created using the provided function.
Example (Concatenating with completion values)
import { Channel, Data } from "effect"
class ConcatError extends Data.TaggedError("ConcatError")<{
readonly reason: string
}> {}
// Create a channel that outputs numbers and terminates with sum
const numberChannel = Channel.fromIterable([1, 2, 3]).pipe(
Channel.concatWith((sum: void) => Channel.succeed(`Completed processing`))
)
// Concatenates additional channel based on completion value
// Outputs: 1, 2, 3, then "Completed processing"
Signature
declare const concatWith: { <OutDone, OutElem1, OutErr1, OutDone1, InElem1, InErr1, InDone1, Env1>(f: (leftover: Types.NoInfer<OutDone>) => Channel<OutElem1, OutErr1, OutDone1, InElem1, InErr1, InDone1, Env1>): <OutElem, OutErr, InElem, InErr, InDone, Env>(self: Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>) => Channel<OutElem | OutElem1, OutErr1 | OutErr, OutDone1, InElem & InElem1, InErr & InErr1, InDone & InDone1, Env1 | Env>; <OutElem, OutErr, OutDone, InElem, InErr, InDone, Env, OutElem1, OutErr1, OutDone1, InElem1, InErr1, InDone1, Env1>(self: Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>, f: (leftover: Types.NoInfer<OutDone>) => Channel<OutElem1, OutErr1, OutDone1, InElem1, InErr1, InDone1, Env1>): Channel<OutElem | OutElem1, OutErr1 | OutErr, OutDone1, InElem & InElem1, InErr & InErr1, InDone & InDone1, Env1 | Env>; }
Since v4.0.0