import { concreteTake } from "@effect/core/stream/Take/operations/_internal/TakeInternal" /** * Folds over the failure cause, success value and end-of-stream marker to * yield a value. * * @tsplus static effect/core/stream/Take.Aspects fold * @tsplus pipeable effect/core/stream/Take fold */ export function fold( end: Z, error: (cause: Cause) => Z, value: (chunk: Chunk) => Z ) { return (self: Take): Z => { concreteTake(self) return self._exit.fold( (cause) => Cause.flipCauseMaybe(cause).fold(() => end, error), value ) } }