(
push: (
option: Option.Option<Chunk.Chunk<In>>
) => Effect.Effect<void, readonly [Either.Either<Z, E>, Chunk.Chunk<L>], R>
)
| 1442 | new SinkImpl(channel.unwrapScoped(pipe(push, Effect.map(fromPushPull)))) |
| 1443 | |
| 1444 | const fromPushPull = <In, Z, E, L, R>( |
| 1445 | push: ( |
| 1446 | option: Option.Option<Chunk.Chunk<In>> |
| 1447 | ) => Effect.Effect<void, readonly [Either.Either<Z, E>, Chunk.Chunk<L>], R> |
| 1448 | ): Channel.Channel<Chunk.Chunk<L>, Chunk.Chunk<In>, E, never, Z, unknown, R> => |
| 1449 | core.readWith({ |
| 1450 | onInput: (input: Chunk.Chunk<In>) => |
| 1451 | channel.foldChannel(core.fromEffect(push(Option.some(input))), { |
| 1452 | onFailure: ([either, leftovers]) => |
| 1453 | Either.match(either, { |
| 1454 | onLeft: (error) => pipe(core.write(leftovers), channel.zipRight(core.fail(error))), |
| 1455 | onRight: (z) => pipe(core.write(leftovers), channel.zipRight(core.succeedNow(z))) |
| 1456 | }), |
| 1457 | onSuccess: () => fromPushPull(push) |
| 1458 | }), |
| 1459 | onFailure: core.fail, |
| 1460 | onDone: () => |
| 1461 | channel.foldChannel(core.fromEffect(push(Option.none())), { |
| 1462 | onFailure: ([either, leftovers]) => |
| 1463 | Either.match(either, { |
| 1464 | onLeft: (error) => pipe(core.write(leftovers), channel.zipRight(core.fail(error))), |
| 1465 | onRight: (z) => pipe(core.write(leftovers), channel.zipRight(core.succeedNow(z))) |
| 1466 | }), |
| 1467 | onSuccess: () => |
| 1468 | core.fromEffect( |
| 1469 | Effect.dieMessage( |
| 1470 | "BUG: Sink.fromPush - please report an issue at https://github.com/Effect-TS/effect/issues" |
| 1471 | ) |
| 1472 | ) |
| 1473 | }) |
| 1474 | }) |
| 1475 | |
| 1476 | /** @internal */ |
| 1477 | export const fromQueue = <In>( |
nothing calls this directly
no test coverage detected
searching dependent graphs…