Skip to content

Latest commit

 

History

History
43 lines (29 loc) · 820 Bytes

File metadata and controls

43 lines (29 loc) · 820 Bytes

ZERO

ZERO extends DIFF with the zero? predicate:

zero?(0)

zero? introduces Boolean values:

zero?(0)
→ true

zero?(1)
→ false

Once 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 repl

Then:

import ZERO.Interpreter as I

I.run "zero?(-(1, 1))"
-- Ok (VBool True)