Ejemplo n.º 1
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.º 2
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.º 3
0
 public static IIdentityMonad <TResult> MatchRightOrDefault <TLeft, TRight, TResult>(this IEitherMonad <TLeft, TRight> self, Func <TRight, TResult> selector, TResult defaultValue = default(TResult))
 {
     return(new MatchRightOrDefaultCore <TLeft, TRight, TResult>(self, selector, defaultValue));
 }
Ejemplo n.º 4
0
 public IfCore(IEitherMonad <TLeft, TRight> self, IEitherMonad <TLeft, TRight> elseSource, Func <IEitherResult <TLeft, TRight>, bool> selector)
 {
     _self       = self;
     _elseSource = elseSource;
     _selector   = selector;
 }
Ejemplo n.º 5
0
 public static IEitherMonad <TLeft, TResultRight> Select <TLeft, TRight, TResultRight>(this IEitherMonad <TLeft, TRight> self, Func <TRight, TResultRight> selector)
 {
     return(new SelectCore <TLeft, TRight, TResultRight>(self, selector));
 }
Ejemplo n.º 6
0
 public static IEitherMonad <TLeft, TRight> Do <TLeft, TRight>(this IEitherMonad <TLeft, TRight> self, Action <IEitherResult <TLeft, TRight> > action)
 {
     return(new DoCore <TLeft, TRight>(self, action));
 }
Ejemplo n.º 7
0
 public static IIdentityMonad <TResult> Match <TLeft, TRight, TResult>(this IEitherMonad <TLeft, TRight> self, Func <TLeft, TResult> leftSelector, Func <TRight, TResult> rightSelector)
 {
     return(new MatchCore <TLeft, TRight, TResult>(self, leftSelector, rightSelector));
 }
Ejemplo n.º 8
0
 public ShareCore(IEitherMonad <TLeft, TRight> self)
 {
     _self = self;
     _lazy = Lazy.Create <IEitherResult <TLeft, TRight> >(RunSelf);
 }
Ejemplo n.º 9
0
 public AsDefaultPermissionCore(IEitherMonad <TLeft, TRight> self)
 {
     _self = self;
 }
Ejemplo n.º 10
0
 public static IEitherMonad <TLeft, TRight> AsDefaultPermission <TLeft, TRight>(this IEitherMonad <TLeft, TRight> self)
 {
     return(new AsDefaultPermissionCore <TLeft, TRight>(self));
 }
Ejemplo n.º 11
0
 public static IEitherMonad <TLeft, TRight> If <TLeft, TRight>(IEitherMonad <TLeft, TRight> thenSource, IEitherMonad <TLeft, TRight> elseSource, Func <bool> selector)
 {
     return(new IfStaticCore <TLeft, TRight>(thenSource, elseSource, selector));
 }
Ejemplo n.º 12
0
 public IfStaticCore(IEitherMonad <TLeft, TRight> thenSource, IEitherMonad <TLeft, TRight> elseSource, Func <bool> selector)
 {
     _thenSource = thenSource;
     _elseSource = elseSource;
     _selector   = selector;
 }
Ejemplo n.º 13
0
 public static IEitherMonad <TLeft, TRight> If <TLeft, TRight>(this IEitherMonad <TLeft, TRight> self, IEitherMonad <TLeft, TRight> elseSource, Func <IEitherResult <TLeft, TRight>, bool> selector)
 {
     return(new IfCore <TLeft, TRight>(self, elseSource, selector));
 }
Ejemplo n.º 14
0
 public static IEitherMonad <TLeft, TRight> DoOnRight <TLeft, TRight>(this IEitherMonad <TLeft, TRight> self, Action <TRight> action)
 {
     return(new DoOnRightCore <TLeft, TRight>(self, action));
 }
Ejemplo n.º 15
0
 public static IEitherMonad <TLeft, TRight> AsThrowable <TLeft, TRight>(this IEitherMonad <TLeft, TRight> self)
 {
     return(new AsThrowableCore <TLeft, TRight>(self));
 }
Ejemplo n.º 16
0
 public DoOnRightCore(IEitherMonad <TLeft, TRight> self, Action <TRight> action)
 {
     _self   = self;
     _action = action;
 }
Ejemplo n.º 17
0
 public AsThrowableCore(IEitherMonad <TLeft, TRight> self)
 {
     _self = self;
 }
Ejemplo n.º 18
0
 public static IEitherMonad <TLeft, TRight> Share <TLeft, TRight>(this IEitherMonad <TLeft, TRight> self)
 {
     return(new ShareCore <TLeft, TRight>(self));
 }
Ejemplo n.º 19
0
 public static IIdentityMonad <TResult> MatchRight <TLeft, TRight, TResult>(this IEitherMonad <TLeft, TRight> self, Func <TRight, TResult> selector)
 {
     return(new MatchRightCore <TLeft, TRight, TResult>(self, selector));
 }
Ejemplo n.º 20
0
 public MatchCore(IEitherMonad <TLeft, TRight> self, Func <TLeft, TResult> leftSelector, Func <TRight, TResult> rightSelector)
 {
     _self          = self;
     _leftSelector  = leftSelector;
     _rightSelector = rightSelector;
 }
Ejemplo n.º 21
0
 public MatchRightUnitCore(IEitherMonad <TLeft, TRight> self, Action <TRight> action)
 {
     _self   = self;
     _action = action;
 }
Ejemplo n.º 22
0
 public static IEitherMonad <TLeft, TResultRight> SelectMany <TLeft, TFirstRight, TSecondResult, TResultRight>(this IEitherMonad <TLeft, TFirstRight> self, Func <TFirstRight, IEitherMonad <TLeft, TSecondResult> > selector, Func <TFirstRight, TSecondResult, TResultRight> projector)
 {
     return(new SelectManyCore <TLeft, TFirstRight, TSecondResult, TResultRight>(self, selector, projector));
 }
Ejemplo n.º 23
0
 public static IIdentityMonad <Unit> MatchRight <TLeft, TRight, TResult>(this IEitherMonad <TLeft, TRight> self, Action <TRight> action)
 {
     return(new MatchRightUnitCore <TLeft, TRight, TResult>(self, action));
 }
Ejemplo n.º 24
0
 public DoCore(IEitherMonad <TLeft, TRight> self, Action <IEitherResult <TLeft, TRight> > action)
 {
     _self   = self;
     _action = action;
 }
Ejemplo n.º 25
0
 public MatchRightOrDefaultCore(IEitherMonad <TLeft, TRight> self, Func <TRight, TResult> selector, TResult defaultValue)
 {
     _self         = self;
     _selector     = selector;
     _defaultValue = defaultValue;
 }
Ejemplo n.º 26
0
 public SelectCore(IEitherMonad <TLeft, TRight> self, Func <TRight, TResultRight> selector)
 {
     _self     = self;
     _selector = selector;
 }
Ejemplo n.º 27
0
 public static IIdentityMonad <IEitherResult <TLeft, TRight> > ToIdentity <TLeft, TRight>(this IEitherMonad <TLeft, TRight> self)
 {
     return(new ToIdentityCore <TLeft, TRight>(self));
 }