// ets_tracing: off import * as O from "../../../../Option/index.js" import type * as C from "../core.js" import * as CatchAll from "./catchAll.js" import * as Fail from "./fail.js" /** * Switches to the provided stream in case this one fails with the `None` value. * * See also `Stream#catchAll`. */ export function orElseOptional_( self: C.Stream, A>, that: C.Stream, A1> ): C.Stream, A | A1> { return CatchAll.catchAll_( self, O.fold( (): C.Stream, A | A1> => that, (e) => Fail.fail(O.some(e)) ) ) } /** * Switches to the provided stream in case this one fails with the `None` value. * * See also `Stream#catchAll`. * * @ets_data_first orElseOptional_ */ export function orElseOptional(that: C.Stream, A1>) { return (self: C.Stream, A>) => orElseOptional_(self, that) }