Add two numbers.
Modulenatural-arithmetic-0.2.4.0Haskell2010
Arithmetic.Nat
Contents
Synopsis
- value plus
- value plus#
- value monus
- value divide
- value divideRoundingUp
- value times
- value succ
- value succ#
- value withPred#
- value testEqual
- value testEqual#
- value testLessThan
- value testLessThan#
- value testLessThanEqual
- value testLessThanEqual#
- value testZero
- value testZero#
- value =?
- value <?
- value <?#
- value <=?
- value <=?#
- value zero
- value one
- value two
- value three
- value constant
- value constant#
- value zero#
- value one#
- pattern N0#
- pattern N1#
- pattern N2#
- pattern N3#
- pattern N4#
- pattern N5#
- pattern N6#
- pattern N7#
- pattern N8#
- pattern N16#
- pattern N32#
- pattern N64#
- pattern N128#
- pattern N256#
- pattern N512#
- pattern N1024#
- pattern N2048#
- pattern N4096#
- pattern N8192#
- pattern N16384#
- pattern N32768#
- pattern N65536#
- value demote
- value demote#
- value unlift
- value lift
- value with
- value with#
- value substitute#
- Packagenatural-arithmetic-0.2.4.0
- Exports59
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceNat.hs
Addition
Variant of plus for unboxed nats.
Subtraction
Subtract the second argument from the first argument.
Division
Divide two numbers. Rounds down (towards zero)
Divide two numbers. Rounds up (away from zero)
Multiplication
Multiply two numbers.
Successor
The successor of a number.
Unlifted variant of succ.
Predecessor
If a natural number is greater than zero, we can operate on its predecessor.
Compare
Are 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
The 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
The number zero. Unboxed.
The number one. Unboxed.
Unboxed Pattern Synonyms
Convert
Run 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.