recover

fun <A> Program<A>.recover(fallback: (String) -> Program<A>): Program<A>(source)

Recover from a failure: on Failure.Raise, the rest of the failed program is abandoned (there is nothing to resume into) and fallback replaces it. A failure raised inside fallback is not caught here — it propagates to the next outer recover or attempt.

Any effect fallback performs is only seen by handlers applied after this recover — handlers already applied beneath it never see the fallback program. A fallback that logs, for example, needs the log handler outside the recover.