Conditionals
Reject invalid paths first and keep the successful transformation visible.
Branching
Why
Using an exception to distinguish success from failure hides a normal domain alternative from the return type.
Rules
MUST use early-return guards for invalid preconditions.[review]
MUST handle closed domain alternatives explicitly with structural matching or typed guard branches.[review]
MUST avoid authoredraise,try/except, and unchecked Result extraction for branching.[review]
MUST use Resultmapfor successful pure transforms andbindfor fallible transforms.[review]
MUST avoid conditional expressions and deeply nested branches around successful paths.[review]
MUST configure and verify exhaustiveness checks rather than assume Python match statements are exhaustive.[review]
MUST keep assertions for tests rather than runtime input validation.[review]
[review]
Syntax checks can reject exception-control-flow nodes. Strict typing and review establish variant handling; Python alone does not enforce exhaustive matching.
Enforcement
Syntax checks can reject exception-control-flow nodes. Strict typing and review establish variant handling; Python alone does not enforce exhaustive matching.