How can I check user input with dhall ?
For instance the following assertion:
-- ../schemas/Quota.dhall
{ Type = { cpu : Natural }, default.cpu = 1 }
let lessThanEqual = (../../Prelude.dhall).Natural.lessThanEqual
let quota =
λ(config : (../schemas/Quota.dhall).Type) →
let check = assert : lessThanEqual 5 config.cpu ≡ True in config::{}
in quota
will always reply:
→ dhall --explain <<< ‘./openshift/func/makeQuota.dhall {cpu=5}’
Error: Assertion failed
- … …
- True
7│ assert : lessThanEqual 5 config.cpu ≡ True