// ets_tracing: off import * as E from "../Either/index.js" import { pipe } from "../Function/index.js" import { succeed, tryOrElse_ } from "./core.js" import type { Effect } from "./effect.js" import { map_ } from "./map.js" /** * Returns an effect that will produce the value of this effect, unless it * fails, in which case, it will produce the value of the specified effect. * * @ets_data_first orElseEither_ */ export function orElseEither( that: () => Effect, __trace?: string ) { return (self: Effect) => orElseEither_(self, that, __trace) } /** * Returns an effect that will produce the value of this effect, unless it * fails, in which case, it will produce the value of the specified effect. */ export function orElseEither_( self: Effect, that: () => Effect, __trace?: string ): Effect> { return tryOrElse_( self, () => map_(that(), E.right), (x) => pipe(x, E.left, succeed), __trace ) }