Пример #1
0
            public IEitherResult <TLeft, TRight> RunEither()
            {
                IEitherResult <TLeft, TRight> result = _self.RunEither();

                _action(result);
                return(result);
            }
Пример #2
0
            public Unit Run()
            {
                IEitherResult <TLeft, TRight> result = _self.Run();

                _action(result.Right);
                return(Unit.Default);
            }
Пример #3
0
            public Unit RunIdentity()
            {
                IEitherResult <TLeft, TRight> result = _self.RunEither();

                _action(result.Left);
                return(Unit.Default);
            }
Пример #4
0
            public IEitherResult <TLeft, TRight> RunEither()
            {
                IEitherResult <TLeft, TRight> result = _self.RunEither();

                if (result.IsRight)
                {
                    _action(result.Right);
                }
                return(result);
            }
Пример #5
0
            public IEitherResult <TLeft, TResultRight> RunEither()
            {
                IEitherResult <TLeft, TRight> result = _self.RunEither();

                if (result.IsLeft)
                {
                    return(new LeftResult <TLeft, TResultRight>(result.Left));
                }
                else
                {
                    return(new RightResult <TLeft, TResultRight>(_selector(result.Right)));
                }
            }
Пример #6
0
        public static void Execute <TLeft, TRight>(this IEitherMonad <TLeft, TRight> self)
        {
            IEitherResult <TLeft, TRight> selfResult = self.Run();

            if (selfResult.IsRight)
            {
                return;
            }
            else
            {
                return;
            }
        }
Пример #7
0
            public IEitherResult <TLeft, TRight> Run()
            {
                IEitherResult <TLeft, TRight> result = _self.Run();

                if (result.IsLeft)
                {
                    return(new ThrowableLeftResult <TLeft, TRight>(result.Left));
                }
                else
                {
                    return(new ThrowableRightResult <TLeft, TRight>(result.Right));
                }
            }
Пример #8
0
            public IEitherResult <TLeft, TRight> RunEither()
            {
                IEitherResult <TLeft, TRight> result = _self.RunEither();

                if (_selector(result))
                {
                    return(result);
                }
                else
                {
                    return(_elseSource.RunEither());
                }
            }
Пример #9
0
        public static void Execute <TLeft, TRight>(this IEitherMonad <TLeft, TRight> self, Action <TRight> onRight)
        {
            IEitherResult <TLeft, TRight> selfResult = self.RunEither();

            if (selfResult.IsRight)
            {
                return;
            }
            else
            {
                onRight(selfResult.Right);
                return;
            }
        }
Пример #10
0
            public TResult Run()
            {
                IEitherResult <TLeft, TRight> result = _self.Run();

                return(result.IsRight ? _selector(result.Right) : _defaultValue);
            }
Пример #11
0
            public TResult RunIdentity()
            {
                IEitherResult <TLeft, TRight> result = _self.RunEither();

                return(result.IsLeft ? _selector(result.Left) : _defaultValue);
            }