MCPcopy Index your code
hub / github.com/Effect-TS/effect / orElse

Function orElse

packages/effect/src/internal/matcher.ts:544–560  ·  view source on GitHub ↗
(f: F)

Source from the content-addressed store, hash-verified

542/** @internal */
543export const orElse =
544 <RA, Ret, F extends (_: RA) => Ret>(f: F) =>
545 <I, R, A, Pr>(self: Matcher<I, R, RA, A, Pr, Ret>): [Pr] extends [never] ? (input: I) => Unify<ReturnType<F> | A>
546 : Unify<ReturnType<F> | A> =>
547 {
548 const result = either(self)
549
550 if (Either.isEither(result)) {
551 // @ts-expect-error
552 return result._tag === "Right" ? result.right : f(result.left)
553 }
554
555 // @ts-expect-error
556 return (input: I) => {
557 const a = result(input)
558 return a._tag === "Right" ? a.right : f(a.left)
559 }
560 }
561
562/** @internal */
563export const orElseAbsurd = <I, R, RA, A, Pr, Ret>(

Callers 15

booleanFunction · 0.85
goMemoFunction · 0.85
goFunction · 0.85
firstSuccessOfFunction · 0.85
core-effect.tsFile · 0.85
schedule.tsFile · 0.85
repeatOrElseEffectLoopFunction · 0.85
retryOrElse_EffectLoopFunction · 0.85
context.tsFile · 0.85
configProvider.tsFile · 0.85
fiber.tsFile · 0.85
core.tsFile · 0.85

Calls 2

eitherFunction · 0.70
fFunction · 0.50

Tested by

no test coverage detected