|
|
|
|
|
by klibertp
547 days ago
|
|
My understanding is that you get a type error when the type checker cannot prove the result of an operation conforms to a refined type. For constants, it's easy: `(Nat 5) - (Nat 3)` is Nat while `(Nat 5) - (Nat 6)` is a type error. For values coming from elsewhere, you need to give the type-checker some guarantee yourself: let x = Nat 5;
let y = read_nat();
assert y < x; // without this, the following would fail to type check
x - y
(you need occurrence typing, too, in this example)In terms of numbers, what you can expect from refinement types is similar to what you get with CLP(FD) in Prolog. |
|