IF extends ZERO with conditional expressions:
if zero?(0) then 2 else 3A conditional evaluates its condition first, then uses the resulting Boolean value to choose which branch to evaluate. The other branch remains unevaluated.
That means this program succeeds:
if zero?(0) then 2 else -(zero?(0), 1)even though the else branch would produce a runtime type error if it were evaluated.
For a closer look, read IF: Conditional Expressions and Selective Evaluation.
To try it, you'll need Nix with flakes enabled.
nix develop
elm replThen:
import IF.Interpreter as I
I.run "if zero?(0) then 2 else 3"
-- Ok (VNumber 2)