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