예제 #1
0
        /// <seealso cref="Outcome.Lift{T1, T2, T3, T4, T5, TResult}"/>
        public static Outcome <TResult> ZipWith <T1, T2, T3, T4, T5, TResult>(
            this Outcome <T1> @this,
            Outcome <T2> second,
            Outcome <T3> third,
            Outcome <T4> fourth,
            Outcome <T5> fifth,
            Func <T1, T2, T3, T4, T5, TResult> zipper)
        {
            /* T4: NotNull(@this) */
            /* T4: NotNull(second) */
            /* T4: NotNull(third) */
            /* T4: NotNull(fourth) */
            /* T4: NotNull(fifth) */
            Require.NotNull(zipper, nameof(zipper));

            // > return @this.Bind(
            // >     arg1 => second.Bind(
            // >         arg2 => third.Bind(
            // >             arg3 => fourth.Bind(
            // >                 arg4 => fifth.Select(
            // >                     arg5 => zipper(arg1, arg2, arg3, arg4, arg5))))));
            return(@this.Bind(
                       arg1 => second.ZipWith(
                           third,
                           fourth,
                           fifth,
                           (arg2, arg3, arg4, arg5) => zipper(arg1, arg2, arg3, arg4, arg5))));
        }
예제 #2
0
 public static Outcome <TSource> PassBy <TSource, TOther>(
     this Outcome <TSource> @this,
     Outcome <TOther> other)
 {
     /* T4: NotNull(@this) */
     return(@this.ZipWith(other, (arg, _) => arg));
 }
예제 #3
0
        /// <seealso cref="Outcome.Lift{T1, T2, T3, TResult}"/>
        public static Outcome <TResult> ZipWith <T1, T2, T3, TResult>(
            this Outcome <T1> @this,
            Outcome <T2> second,
            Outcome <T3> third,
            Func <T1, T2, T3, TResult> zipper)
        {
            /* T4: NotNull(@this) */
            /* T4: NotNull(second) */
            /* T4: NotNull(third) */
            Require.NotNull(zipper, nameof(zipper));

            // This is the same as:
            // > return @this.Bind(
            // >     arg1 => second.Bind(
            // >        arg2 => third.Select(
            // >            arg3 => zipper(arg1, arg2, arg3))));
            // but faster if ZipWith is locally shadowed.
            return(@this.Bind(
                       arg1 => second.ZipWith(
                           third, (arg2, arg3) => zipper(arg1, arg2, arg3))));
        }