FunSharp.Common/EitherExtensions.cs
//--------------------------------------------------
/// <summary>
/// If <paramref name="either" /> is right, use
/// it to compute another <see cref="Either{TLeft,TRight}"/>.
/// </summary>
If  is right, use
it to compute another .
If is right use it to compute another .
[NotNull]
        public static Either<TLeft, TRight2> BindRight<TLeft, TRight1, TRight2>(
            [NotNull] this Either<TLeft, TRight1> either,
            [NotNull] Func<TRight1, Either<TLeft, TRight2>> makeNextChoice)
        {
            if (either is null) throw new ArgumentNullException(nameof(either));
            if (makeNextChoice is null) throw new ArgumentNullException(nameof(makeNextChoice));
            switch (either)
            {
                case EitherLeft<TLeft, TRight1> left: return Either.Left(left.Value, new TypeHint<TRight2>());
                case EitherRight<TLeft, TRight1> right: return makeNextChoice(right.Value);
                default: throw new ArgumentOutOfRangeException(nameof(either));
            }
        }
[ NotNull ] public static Either < TLeft , TRight2 > BindRight < TLeft , TRight1 , TRight2 > ( [ NotNull ] this Either < TLeft , TRight1 > either , [ NotNull ] Func < TRight1 , Either < TLeft , TRight2 > > makeNextChoice ) { if ( either is null ) throw new ArgumentNullException ( nameof ( either ) ) ; if ( makeNextChoice is null ) throw new ArgumentNullException ( nameof ( makeNextChoice ) ) ; switch ( either ) { case EitherLeft < TLeft , TRight1 > left : return Either . Left ( left . Value , new TypeHint < TRight2 > ( ) ) ; case EitherRight < TLeft , TRight1 > right : return makeNextChoice ( right . Value ) ; default : throw new ArgumentOutOfRangeException ( nameof ( either ) ) ; } }
If  is right, use
it to compute another .
If is right use it to compute another .
this
[NotNull]
Func<TRight1, Either<TLeft, TRight2>>
[NotNull]