def rollback
import bendvy-ecs-core@0.1.0.4/transaction.bend as Transactionimport Base
61# Trusted lower-level journal execution: apply inverse closures head first
62# and return World. Only recorded changes are undone; no general mutation or
63# external-effect rollback is inferred from calling this function.
64def rollback(~W: Type, undo: List<&1, (W -> W)>, world: W) -> W:
65 match undo:
66 case Nil{}:
67 world
68 case Con{inverse, rest}:
69 rollback(~W, rest, inverse(world))