Navigation

Conditions

CL-style condition system: signal/warn with restart-based recovery.

collectConditions

conditions.collectConditions: handler that accumulates each condition into state as { name, data } and resumes with continue.

Collecting handler: accumulates conditions in state, resumes with continue. State shape: list of { name, data } Initial state: []

fail

conditions.fail: last-resort handler that throws on any condition (via builtins.throw); ignores available restarts.

Fail handler: throws on any condition. Ignores available restarts. Use as a last-resort handler.

ignore

conditions.ignore: handler that silently discards every condition by resuming with { restart = "continue"; value = null; }.

Ignore handler: resumes with null for any condition. All conditions are silently discarded.

signal

signal: raise a CL-style condition with name, data, and available restart names; the handler returns { restart, value } to choose recovery.

signal : string -> any -> [string] -> Computation any

Signal a condition. The handler chooses a restart strategy.

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

warn: raise a warning condition with the conventional muffle-warning restart; if the handler doesn't muffle, computation continues.

warn : string -> any -> Computation null

Signal a warning condition. Like signal but with a conventional "muffle-warning" restart. If the handler doesn't muffle, the computation continues normally.

withRestart

withRestart: handler factory invoking a named restart with a given value for one matched condition; throws on every other condition.

withRestart : string -> string -> any -> handler

Create a handler that invokes a specific restart for a named condition. For all other conditions, falls through (throws).

Arguments: - condName — condition name to match - restartName — restart to invoke - restartVal — value to pass via the restart