public static TState Execute <TEnvironment, TOutput, TState, TValue>(this IRWSMonad <TEnvironment, TOutput, TState, TValue> self, TEnvironment environment, TState state, Action <TValue> onValue) { RWSResult <TOutput, TState, TValue> selfResult = self.RunRWS(environment, state); onValue(selfResult.Value); return(selfResult.State); }
public RWSResult <TOutput, TState, TValue> RunRWS(TEnvironment environment, TState state) { RWSResult <TOutput, TState, TValue> selfResult = _self.RunRWS(environment, state); _action(selfResult.Output); return(selfResult); }
public static TState Execute <TEnvironment, TOutput, TState, TValue>(this IRWSMonad <TEnvironment, TOutput, TState, TValue> self, TEnvironment environment, TState state, Action <TValue> onValue, Action <TState> onState, Action <IEnumerable <TOutput> > onOutput) { RWSResult <TOutput, TState, TValue> selfResult = self.Run(environment, state); onValue(selfResult.Value); onState(selfResult.State); onOutput(selfResult.Output); return(selfResult.State); }
public RWSResult <TOutput, TState, TValue> Run(TEnvironment environment, TState state) { RWSResult <TOutput, TState, TValue> result = _self.Run(environment, state); if (_selector(result)) { return(result); } else { return(_elseSource.Run(environment, state)); } }
public RWSResult <TOutput, TState, TResult> RunRWS(TEnvironment environment, TState state) { RWSResult <TOutput, TState, TValue> selfResult = _self.RunRWS(environment, state); return(_selector(selfResult.Value).RunRWS(environment, selfResult.State ?? state)); }
public RWSResult <TOutput, TState, TValue> Run(TEnvironment environment, TState state) { return(RWSResult.Create(_value, new TOutput[0], state)); }
public static IRWSMonad <TEnvironment, TOutput, TState, TValue> Tell <TEnvironment, TOutput, TState, TValue>(TValue value, IEnumerable <TOutput> outputs) { return(RWS.Create <TEnvironment, TOutput, TState, TValue>((e, s) => RWSResult.Create(value, outputs, s))); }
public static IRWSMonad <TEnvironment, TOutput, TState, TValue> Tell <TEnvironment, TOutput, TState, TValue>(TValue value, TOutput output) { return(RWS.Create <TEnvironment, TOutput, TState, TValue>((e, s) => RWSResult.Create(value, new TOutput[1] { output }, s))); }
public RWSResult <TOutput, TState, Unit> Run(TEnvironment environment, TState state) { return(RWSResult.Create(Unit.Default, new TOutput[1] { _output }, state)); }
public RWSResult <TOutput, TState, TState> Run(TEnvironment environment, TState state) { return(RWSResult.Create(state, new TOutput[0], _selector(state))); }
public RWSResult <TOutput, TState, TEnvironment> RunRWS(TEnvironment environment, TState state) { return(RWSResult.Create(_selector(environment), new TOutput[0], state)); }