(f: F)
| 542 | /** @internal */ |
| 543 | export 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 */ |
| 563 | export const orElseAbsurd = <I, R, RA, A, Pr, Ret>( |
no test coverage detected