MCPcopy Create free account
hub / github.com/Effect-TS/effect / process

Function process

packages/effect/src/internal/stream.ts:3691–3721  ·  view source on GitHub ↗
(
              leftDone: boolean,
              rightDone: boolean
            )

Source from the content-addressed store, hash-verified

3689 ),
3690 Effect.map(([left, right]) => {
3691 const process = (
3692 leftDone: boolean,
3693 rightDone: boolean
3694 ): Channel.Channel<Chunk.Chunk<A | A2>, boolean, E | E2 | E3, E | E2 | E3, void, unknown, R> =>
3695 core.readWithCause({
3696 onInput: (bool: boolean) => {
3697 if (bool && !leftDone) {
3698 return pipe(
3699 core.fromEffect(Handoff.take(left)),
3700 core.flatMap(InternalTake.match({
3701 onEnd: () => rightDone ? core.void : process(true, rightDone),
3702 onFailure: core.failCause,
3703 onSuccess: (chunk) => pipe(core.write(chunk), core.flatMap(() => process(leftDone, rightDone)))
3704 }))
3705 )
3706 }
3707 if (!bool && !rightDone) {
3708 return pipe(
3709 core.fromEffect(Handoff.take(right)),
3710 core.flatMap(InternalTake.match({
3711 onEnd: () => leftDone ? core.void : process(leftDone, true),
3712 onFailure: core.failCause,
3713 onSuccess: (chunk) => pipe(core.write(chunk), core.flatMap(() => process(leftDone, rightDone)))
3714 }))
3715 )
3716 }
3717 return process(leftDone, rightDone)
3718 },
3719 onFailure: core.failCause,
3720 onDone: () => core.void
3721 })
3722 return pipe(
3723 toChannel(decider),
3724 channel.concatMap(channel.writeChunk),

Callers 2

stream.tsFile · 0.70
zipWithNextFunction · 0.70

Calls 6

fromEffectMethod · 0.80
pipeFunction · 0.70
takeMethod · 0.65
writeMethod · 0.65
mapMethod · 0.65
ofMethod · 0.65

Tested by

no test coverage detected