示例#1
0
文件: Either.cs 项目: PaulWild/FX
 private bool Equals(Either <L, R> other)
 {
     return(IsRight == other.IsRight && EqualityComparer <L> .Default.Equals(LeftValue, other.LeftValue) && EqualityComparer <R> .Default.Equals(RightValue, other.RightValue));
 }
示例#2
0
文件: Either.cs 项目: PaulWild/FX
 public Either <L, TResult> SelectMany <TResult>(Func <R, Either <L, TResult> > f)
 {
     return(IsRight
         ? f(RightValue)
         : Either <L, TResult> .Left(LeftValue));
 }
示例#3
0
文件: Either.cs 项目: PaulWild/FX
 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))));
 }
示例#4
0
文件: Either.cs 项目: PaulWild/FX
 public Either <L, TResult> Select <TResult>(Func <R, TResult> f)
 {
     return(IsRight
         ? Either <L, TResult> .Right(f(RightValue))
         : Either <L, TResult> .Left(LeftValue));
 }