FromResidual

public protocol FromResidual[Residual]

Protocol that lets a return type absorb a try-propagated residual.

Implement when your error/optional type should be reachable via try from another type with a different residual. For example, Result[T, E] implements FromResidual[E] so that try someResult inside a function returning Result[T, E] rebuilds the failure.

Methods

static func fromResidual(consuming Residual) -> Self

Builds an instance carrying residual as its failure payload.

Defined in lang/std/core/error.ks