コード例 #1
0
 public static bool IsRight <TLeft, TRight>(this Either <TLeft, TRight> either)
 {
     return(either.Tag == EitherType.Right);
 }
コード例 #2
0
 public static Either <TLeft, TResult> Bind <TLeft, TRight, TResult>(
     this Either <TLeft, TRight> either,
     Func <TRight, Either <TLeft, TResult> > func)
 {
     return(Either.Bind(either, func));
 }
コード例 #3
0
 public static Either <TLeft, TResult> Map <TLeft, TRight, TResult>(
     this Either <TLeft, TRight> either,
     Func <TRight, TResult> func)
 {
     return(Either.Map(either, func));
 }
コード例 #4
0
 /// <summary>
 /// Equivalent to monadic <see cref="CSharpx.Either.Return{TRight}"/> operation.
 /// Builds a <see cref="CSharpx.Right{TLeft, TRight}"/> value in case <paramref name="value"/> by default.
 /// </summary>
 public static Either <string, TRight> ToEither <TRight>(this TRight value)
 {
     return(Either.Return <TRight>(value));
 }