예제 #1
0
        public static TState Execute <TState, TValue>(this IStateMonad <TState, TValue> self, TState state, Action <TValue> onValue)
        {
            StateResult <TState, TValue> result = self.Run(state);

            onValue(result.Value);
            return(result.State);
        }
예제 #2
0
            public StateResult <TState, TValue> Run(TState state)
            {
                StateResult <TState, TValue> result = _self.Run(state);

                _action(result);
                return(result);
            }
예제 #3
0
            public StateResult <TState, TValue> RunState(TState state)
            {
                StateResult <TState, TValue> result = _self.RunState(state);

                if (_selector(result))
                {
                    return(result);
                }
                else
                {
                    return(_elseSource.RunState(state));
                }
            }
예제 #4
0
            public StateResult <TState, TResult> Run(TState state)
            {
                StateResult <TState, TValue> result = _self.Run(state);

                return(StateResult.Create(result.State, _selector(result.Value)));
            }
예제 #5
0
 public StateResult <TState, RWSResult <TOutput, TState, TValue> > RunState(TState state)
 {
     return(StateResult.Create(state, _self.RunRWS(_environment, state)));
 }
예제 #6
0
 public StateResult <TState, TState> Run(TState state)
 {
     return(StateResult.Create(_state, _state));
 }
예제 #7
0
 public StateResult <TState, Unit> RunState(TState state)
 {
     return(StateResult.Create(_state, Unit.Default));
 }
예제 #8
0
 public StateResult <TState, TState> RunState(TState state)
 {
     return(StateResult.Create(state, _selector(state)));
 }
예제 #9
0
            public StateResult <TState, TValue> RunState(TState state)
            {
                StateResult <TState, TValue> result = _self.RunState(state);

                return(StateResult.Create(_selector(result.State), result.Value));
            }