Conditions
CL-style condition system: signal/warn with restart-based recovery.
collectConditions
Collecting handler: accumulates conditions in state, resumes with continue. State shape: list of { name, data } Initial state: []
fail
Fail handler: throws on any condition. Ignores available restarts. Use as a last-resort handler.
ignore
Ignore handler: resumes with null for any condition. All conditions are silently discarded.
signal
Signal a condition. The handler chooses a restart strategy.
signal : string -> any -> [string] -> Computation any
Arguments:
- name — condition name (e.g. "division-by-zero", "file-not-found")
- data — condition data (error details, context)
- restarts — list of available restart names
The handler receives { name, data, restarts } and returns a
{ restart, value } attrset. The continuation receives this choice.
warn
Signal a warning condition. Like signal but with a conventional
"muffle-warning" restart. If the handler doesn't muffle, the
computation continues normally.
warn : string -> any -> Computation null
withRestart
Create a handler that invokes a specific restart for a named condition. For all other conditions, falls through (throws).
withRestart : string -> string -> any -> handler
Arguments:
- condName — condition name to match
- restartName — restart to invoke
- restartVal — value to pass via the restart