when<R> abstract method

R when<R>({
  1. required R ok(
    1. T
    ),
  2. required R err(
    1. E
    ),
})

Invokes either ok or err depending on the result.

Identical to match except that the arguments are named.

Implementation

R when<R>({required R Function(T) ok, required R Function(E) err});