def execute
bendvy-ecs-core@0.1.0.4 · schedule_with_barrier.bend:6
import bendvy-ecs-core@0.1.0.4/schedule_with_barrier.bend as ScheduleWithBarrier
import Base
import bendvy-ecs-core@0.1.0.4/world.bend as W
import bendvy-ecs-core@0.1.0.4/system.bend as Sys
import bendvy-ecs-core@0.1.0.4/schedule.bend as Sch
6
7def execute(~S: Data,~C: Type,~R: Type,~E: Data,~H: Type,~Error: Data,~skip: H -> W.World<S,C,R,E> -> U32 -> H & W.World<S,C,R,E>,~dispatch: H -> W.World<S,C,R,E> -> U32 -> H & Sys.Outcome<W.World<S,C,R,E>,Error,Unit>,~barrier: H -> W.World<S,C,R,E> -> H & W.World<S,C,R,E>,~condition: W.World<S,C,R,E> -> U32 -> W.World<S,C,R,E> & Bool,steps: List<&2,Sch.Step>,owners: H,world: W.World<S,C,R,E>,+namespace: U32,+name: String,+all: List<&2,Sch.Step>,+observations: List<&2,Sch.Observation>) -> Sch.RunResult<S,C,R,E,H,Error>:
8 match steps:
9 case []: Sch.Finished{Sch.Schedule{namespace,name,all,owners},world,observations}
10 case Sch.Phase{phase} <> rest: execute(~S,~C,~R,~E,~H,~Error,~skip,~dispatch,~barrier,~condition,rest,owners,world,namespace,name,all,List.append(&2,Sch.Observation,observations,[Sch.Entered{phase}]))
11 case Sch.Barrier{} <> rest: Sch.after_skip(~S,~C,~R,~E,~H,~Error,h => w => obs => execute(~S,~C,~R,~E,~H,~Error,~skip,~dispatch,~barrier,~condition,rest,h,w,namespace,name,all,obs),barrier(owners,world),List.append(&2,Sch.Observation,observations,[Sch.Applied{}]))
12 case Sch.System{+id,slot} <> rest: Sch.after_condition_skip(~S,~C,~R,~E,~H,~Error,~skip,~dispatch,h => w => obs => execute(~S,~C,~R,~E,~H,~Error,~skip,~dispatch,~barrier,~condition,rest,h,w,namespace,name,all,obs),condition(world,slot),owners,namespace,name,all,observations,id)