/** * Executed `that` in case `self` fails with a `Cause` that doesn't contain * defects, executes `success` in case of successes * * @tsplus static effect/core/io/Effect.Aspects tryOrElse * @tsplus pipeable effect/core/io/Effect tryOrElse */ export function tryOrElse( that: LazyArg>, success: (a: A) => Effect ) { return (self: Effect): Effect => self.foldCauseEffect( (cause) => cause.keepDefects.fold(that, Effect.failCause), success ) }