def conditioned

bendvy-ecs-core@0.1.0.3 · dependency_executor.bend:39

import bendvy-ecs-core@0.1.0.3/dependency_executor.bend as DependencyExecutor
import Base

39def conditioned(~State:Type,~Requirement:Data,~Error:Data,~Out:Data,~dispatch:State -> U32 -> State & Invocation<Error,Out>,~handler:State -> Error -> State & Handling,next:State -> List<&2,Observation<Error,Out>> -> ExecutionResult<State,Requirement,Error,Out>,returned:State & Condition<Error>,+id:U32,events:List<&2,Observation<Error,Out>>) -> ExecutionResult<State,Requirement,Error,Out>:
40  match returned:
41    case (state,Allowed{}):invoked(~State,~Requirement,~Error,~Out,~handler,next,dispatch(state,id),id,events)
42    case (state,Disabled{}):next(state,List.append(&2,Observation<Error,Out>,events,[Skipped{id}]))
43    case (state,ConditionError{+error}):handled(~State,~Requirement,~Error,~Out,next,handler(state,error),error,List.append(&2,Observation<Error,Out>,events,[ConditionFailed{id,error}]))
44    case (state,ConditionRefused{}):next(state,List.append(&2,Observation<Error,Out>,events,[ConditionRejected{id}]))

Uses (12)

Used by (2)