// Test some examples from the error handling documentation io.out "Testing error handling documentation examples..."; // Basic Result usage divide : x y -> when y is 0 then Err "Division by zero" _ then Ok (x / y); handleDivision : x y -> when (divide x y) is Ok result then result Err message then 0; io.out "Division test:"; io.out (handleDivision 10 2); // Should be 5 io.out (handleDivision 10 0); // Should be 0 // Validation patterns validateAge : age -> when (validate.type "Int" age) is false then Err "Age must be an integer" true then when (validate.range 0 150 age) is false then Err "Age must be between 0 and 150" true then Ok age; io.out "Validation test:"; io.out (validateAge 25); // Should be Ok 25 io.out (validateAge 200); // Should be error // Simple assertion assert (2 + 2 = 4) "Math works"; io.out "Assertion passed!"; // Debug example debug.print "Debug test" 42; io.out "Error handling documentation examples work!";