Пример #1
0
        public static IEither <T, T2> JoinRight <T, T2>(this IEither <T, IEither <T, T2> > either)
        {
            if (either.IsLeft)
            {
                return(new Left <T, T2>(either.GetLeft()));
            }

            return(either.GetRight());
        }
Пример #2
0
        public static T3 Fold <T, T2, T3>(this IEither <T, T2> either, Func <T, T3> leftFunc, Func <T2, T3> rightFunc)
        {
            if (either.IsLeft)
            {
                return(leftFunc(either.GetLeft()));
            }

            return(rightFunc(either.GetRight()));
        }
Пример #3
0
        public static IEither <T, T2> JoinLeft <T, T2>(this IEither <IEither <T, T2>, T2> either)
        {
            if (either.IsRight)
            {
                return(new Right <T, T2>(either.GetRight()));
            }

            return(either.GetLeft());
        }