Пример #1
0
 public Either <L, TResult> SelectMany <TResult>(Func <R, Either <L, TResult> > f)
 {
     return(IsRight
         ? f(RightValue)
         : Either <L, TResult> .Left(LeftValue));
 }
Пример #2
0
 public Either <L, TResult> SelectMany <TCollection, TResult>(Func <R, Either <L, TCollection> > collectionSelector, Func <R, TCollection, TResult> resultSelector)
 {
     return(!IsRight
         ? Either <L, TResult> .Left(LeftValue)
         : collectionSelector(RightValue).Match(Either <L, TResult> .Left, x => Either <L, TResult> .Right(resultSelector(RightValue, x))));
 }
Пример #3
0
 public Either <L, TResult> Select <TResult>(Func <R, TResult> f)
 {
     return(IsRight
         ? Either <L, TResult> .Right(f(RightValue))
         : Either <L, TResult> .Left(LeftValue));
 }