Total validation with match() + Exception
// Multi-capability type: validation with logging and error handling
// Demonstrates record-based capabilities for clean composition
type ConfigProgramCaps = Readonly<{
console: typeof Console.spec;
exception: typeof Exception.spec;
}>;
const config = (): Eff<ConfigSnapshot, ConfigProgramCaps> =>
seq()
.let("input", () => configInput)
.tap((input) => Console.log(`Validating ${input.label}`))
.let("feature", (input) => ensureFlag(input.featureFlag))
.let("throttle", (_, ctx) => ensureThrottle(ctx!["input"].throttle))
.returnWith(({ input, feature, throttle }) => ({
feature,
throttle,
label: input.label,
}));
Console output, timeline events will render here after you run the program.
Handlers: Console.capture() ยท Exception.tryCatch()