ZERO extends DIFF with the zero? predicate:
zero?(0)zero? introduces Boolean values:
zero?(0)
→ true
zero?(1)
→ falseOnce expressions can produce both numbers and Booleans, an operation can receive a value of the wrong type:
zero?(zero?(0))The inner zero? produces a Boolean, but the outer zero? expects a number. ZERO introduces runtime type errors to handle cases like this.
For a closer look, read ZERO: Boolean Values and Runtime Type Errors.
To try it, you'll need Nix with flakes enabled.
nix develop
elm replThen:
import ZERO.Interpreter as I
I.run "zero?(-(1, 1))"
-- Ok (VBool True)