Expect an exact value.
InNat.addN for example also uses the knowledge that the number is exact to describe the number as differences between other type variables.
addN :
Nat
(N
added
(Is min To sumMin)
(Is max To sumMax)
)
-> Nat (In min max)
-> Nat (In sumMin sumMax)You can just ignore the second difference if you don't need it (MinNat.addN).
addN :
Nat (N added (Is min To sumMin) x)
-> Nat (In min max maybeN)
-> Nat (ValueMin sumMin)Is a To b: an exact value as the diffference b - a.
N Nat5
(Nat5Plus more)
(Is myAge To sistersAge)
(Is mothersAge To fathersAge)myAge + 5 = sistersAgemothersAge + 5 = fathersAgeNo special meaning.
Is a To b→ distance b - a.
Only value / return types should be Min.
Sometimes, you simply cannot compute a maximum.
abs : Int -> Nat (ValueIn Nat0 ??)This is where to use Min.
abs : Int -> Nat (Min Nat0)Every Min min is of type In min ....
ValueIn minimum maximum: A value somewhere within a minimum & maximum. We don't know the exact value, though.
↓ minimum ↓ maximum
⨯ [✓ ✓ ✓ ✓ ✓ ✓ ✓] ⨯ ⨯ ⨯...To be used as a return type, not as a function argument.
A number between 3 and 5
Nat (ValueIn Nat3 (Nat5Plus a))A number, at least 5:
Nat (ValueIn Nat5 (Nat5Plus a))The most detailed description of an exact value.
Don't use this as a function argument.
In minimum maximum maybeN: Somewhere within a minimum & maximum.Note: maximum >= minimum for every existing
Nat (In min max ...):→
min <= Nat100If you want a number where you just care about the minimum, leave the
maxas a type variable.Any natural number:
A number, at least 5:
maxcould be a maximum value if there is onemaybeNcould contain extra information forN ...if the number was exact