// ets_tracing: off import * as CS from "../../../../Cause/index.js" import * as E from "../../../../Either/index.js" import type * as C from "../core.js" import * as CatchAllCause from "./catchAllCause.js" import * as FailCause from "./failCause.js" /** * Switches over to the stream produced by the provided function in case this one * fails with a typed error. */ export function catchAll_( self: C.Stream, f: (e: E) => C.Stream ): C.Stream { return CatchAllCause.catchAllCause_(self, (_) => E.fold_(CS.failureOrCause(_), f, (_) => FailCause.failCause(_)) ) } /** * Switches over to the stream produced by the provided function in case this one * fails with a typed error. * * @ets_data_first catchAll_ */ export function catchAll(f: (e: E) => C.Stream) { return (self: C.Stream) => catchAll_(self, f) }