Ejemplo n.º 1
0
 public static Try <Option <B> > Traverse <A, B>(this Option <Try <A> > ma, Func <A, B> f) => () =>
 {
     if (ma.IsNone)
     {
         return(new Result <Option <B> >(Option <B> .None));
     }
     var mr = ma.Value();
     if (mr.IsBottom)
     {
         return(new Result <Option <B> >(BottomException.Default));
     }
     if (mr.IsFaulted)
     {
         return(new Result <Option <B> >(mr.Exception));
     }
     return(new Result <Option <B> >(Option <B> .Some(f(mr.Value))));
 };