dhall-nix-lib/Integer/nonNegative.dhall

19 lines
444 B
Text
Raw Normal View History

2022-09-01 08:05:34 +00:00
{-|
Returns `True` for `+0` and any positive `Integer`.
`nonNegative` is more efficient than `./greaterThanEqual +0` or `./greaterThan -1`.
-}
let nonPositive = ./nonPositive.dhall
let nonNegative
: Integer → Bool
= λ(n : Integer) → nonPositive (Integer/negate n)
let example0 = assert : nonNegative +1 ≡ True
let example1 = assert : nonNegative +0 ≡ True
let example2 = assert : nonNegative -1 ≡ False
in nonNegative