Exemple #1
0
 public StateEither <TState, TLeft, TRight> CombineTakeLeft <TOtherRight>(StateEither <TState, TLeft, TOtherRight> otherState)
 {
     return(new StateEither <TState, TLeft, TRight>(
                from e1 in Out
                from e2 in otherState.Out
                select e1.CombineTakeLeft(e2)));
 }
Exemple #2
0
 public StateEither <TState, TLeft, TRight> Or(StateEither <TState, TLeft, TRight> otherState)
 {
     return(new StateEither <TState, TLeft, TRight>(new State <TState, IEither <TLeft, TRight> >(state =>
     {
         var res1 = Out.Run(state);
         var e1 = res1.Item2;
         return e1.Match(
             right: val => Tuple.Create(res1.Item1, val.AsRight <TLeft, TRight>()),
             left: _ =>
         {
             var res2 = otherState.Out.Run(state);
             var e2 = res2.Item2;
             return e2.Match(
                 right: val => Tuple.Create(res2.Item1, val.AsRight <TLeft, TRight>()),
                 left: err => Tuple.Create(res2.Item1, err.AsLeft <TLeft, TRight>()));
         });
     })));
 }