Ejemplo n.º 1
0
            public IEitherResult <TLeft, TRight> RunEither()
            {
                IEitherResult <TLeft, TRight> result = _self.RunEither();

                _action(result);
                return(result);
            }
Ejemplo n.º 2
0
            public Unit Run()
            {
                IEitherResult <TLeft, TRight> result = _self.Run();

                _action(result.Right);
                return(Unit.Default);
            }
Ejemplo n.º 3
0
            public Unit RunIdentity()
            {
                IEitherResult <TLeft, TRight> result = _self.RunEither();

                _action(result.Left);
                return(Unit.Default);
            }
Ejemplo n.º 4
0
            public IEitherResult <TLeft, TRight> RunEither()
            {
                IEitherResult <TLeft, TRight> result = _self.RunEither();

                if (result.IsRight)
                {
                    _action(result.Right);
                }
                return(result);
            }
Ejemplo n.º 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)));
                }
            }
Ejemplo n.º 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;
            }
        }
Ejemplo n.º 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));
                }
            }
Ejemplo n.º 8
0
            public IEitherResult <TLeft, TRight> RunEither()
            {
                IEitherResult <TLeft, TRight> result = _self.RunEither();

                if (_selector(result))
                {
                    return(result);
                }
                else
                {
                    return(_elseSource.RunEither());
                }
            }
Ejemplo n.º 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;
            }
        }
Ejemplo n.º 10
0
            public TResult Run()
            {
                IEitherResult <TLeft, TRight> result = _self.Run();

                return(result.IsRight ? _selector(result.Right) : _defaultValue);
            }
Ejemplo n.º 11
0
            public TResult RunIdentity()
            {
                IEitherResult <TLeft, TRight> result = _self.RunEither();

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