State transitions with match() guards
const program = () =>
seq()
.let(() => State.get<Light>()) // ctx.v1
.tap((current) => Console.op.log(`Current: ${lightLabel(current)}`))
.then((current) => nextLight(current))
.tap((next) => State.put(next))
.tap((next) => Console.op.log(`Next: ${lightLabel(next)}`))
.return((next, ctx) => ({ previous: ctx!["v1"] as Light, current: next }));
Console output, timeline events and traffic light state snapshots will render here after you run the program.
Handlers: Console.capture() · State.with() · Exception.tryCatch()