예제 #1
0
 Exception ExceptionOrDefault(Exceptional <T> ex)
 => ex.Match(exc => exc, _ => default(Exception));
예제 #2
0
 bool IsSuccess(Exceptional <T> ex)
 => ex.Match(_ => false, _ => true);
예제 #3
0
 T ValueOrDefault(Exceptional <T> ex)
 => ex.Match(exc => default(T), t => t);
예제 #4
0
 public static Validation<Exceptional<R>> Traverse<T, R>
    (this Exceptional<T> tr, Func<T, Validation<R>> f)
    => tr.Match(
       Exception: e => Valid((Exceptional<R>)e),
       Success: t => from r in f(t) select Exceptional(r));