示例#1
0
 public static Option <A> AsOption <A>(this Try <A> either, Action <Exception> callback)
 => either.Else(Option <A> .Return, e =>
 {
     callback(e);
     return(Option <A> .None);
 });
示例#2
0
 public static Either <A, Error> AsEither <A, Error>(this Try <A> either, Func <Exception, Error> errorMap)
 => either.Else(Either <A, Error> .Create, ex => errorMap(ex));
示例#3
0
 public static A ElseThrow <A>(this Try <A> either)
 {
     return(either.Else(exc => { throw exc; }));
 }