Add two numbers.
Modulenatural-arithmetic-0.2.4.0Haskell2010
Arithmetic.Nat
- 37 values
- Packagenatural-arithmetic-0.2.4.0
- Exports59
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceNat.hs
Addition
2 declarationsVariant of plus for unboxed nats.
Subtraction
1 declarationSubtract the second argument from the first argument.
Division
2 declarationsDivide two numbers. Rounds down (towards zero)
Divide two numbers. Rounds up (away from zero)
Multiplication
1 declarationMultiply two numbers.
Successor
2 declarationsThe successor of a number.
Unlifted variant of succ.
Predecessor
1 declarationIf a natural number is greater than zero, we can operate on its predecessor.
Compare
13 declarationsAre the two arguments equal to one another?
Is the first argument strictly less than the second argument?
Is the first argument less-than-or-equal-to the second argument?
Is zero equal to this number or less than it?
Infix synonym of testEqual.
Infix synonym of testLessThan.
Infix synonym of testLessThanEqual.
Constants
6 declarationsThe number zero.
The number one.
The number two.
The number three.
Use GHC's built-in type-level arithmetic to create a witness of a type-level number. This only reduces if the number is a constant.
Unboxed Constants
2 declarationsThe number zero. Unboxed.
The number one. Unboxed.
Unboxed Pattern Synonyms
22 declarationsConvert
6 declarationsRun a computation on a witness of a type-level number. The argument Int must be greater than or equal to zero. This is not checked. Failure to upload this invariant will lead to a segfault.