uint64
UInt64: the integers from 0 to 18446744073709551615, wrapping around as the
machine’s do: fromInt 18446744073709551616 is 0, fromInt (-1) is 18446744073709551615. A literal checked at UInt64 is one ((7 : UInt64)).
Import it by a name, import uint64 as UInt64, as the other fixed-width
types’ modules have the same names: UInt64.fromInt, UInt64.minBound. None
of them is the prelude’s: its instances are the prelude’s operators
and functions at UInt64, wherever it is imported, by a name or not —
x + 1, x / y, -x, x < y, max x y, and x y — so that,
opened, it is in the way of none of them at another type. (Another
fixed-width type’s value from one goes by way of an Int: toInt,
then the other’s fromInt.)
uint64Add
uint64Add : UInt64 -> UInt64 -> UInt64uint64Sub
uint64Sub : UInt64 -> UInt64 -> UInt64uint64Mul
uint64Mul : UInt64 -> UInt64 -> UInt64uint64Div
uint64Div : UInt64 -> UInt64 -> UInt64uint64Rem
uint64Rem : UInt64 -> UInt64 -> UInt64uint64Lt
uint64Lt : UInt64 -> UInt64 -> Booluint64Le
uint64Le : UInt64 -> UInt64 -> Booluint64And
uint64And : UInt64 -> UInt64 -> UInt64uint64Or
uint64Or : UInt64 -> UInt64 -> UInt64uint64Xor
uint64Xor : UInt64 -> UInt64 -> UInt64uint64Shl
uint64Shl : UInt64 -> UInt64 -> UInt64uint64Shr
uint64Shr : UInt64 -> UInt64 -> UInt64uint64Show
uint64Show : UInt64 -> Stringuint64FromInt
uint64FromInt : Int -> UInt64uint64ToInt
uint64ToInt : UInt64 -> IntminBound
minBound : UInt64The least.
maxBound
maxBound : UInt64The greatest.
add
add : UInt64 -> UInt64 -> UInt64The sum, wrapped around: add maxBound 1 is minBound.
sub
sub : UInt64 -> UInt64 -> UInt64mul
mul : UInt64 -> UInt64 -> UInt64div
div : UInt64 -> UInt64 -> UInt64Division rounding toward zero (as C’s, not as an Int’s /); by 0,
0.
rem
rem : UInt64 -> UInt64 -> UInt64The remainder of div; by 0, the dividend, so that add (mul (div x y) y) (rem x y) is x whatever y is.
eq
eq : UInt64 -> UInt64 -> Boollt
lt : UInt64 -> UInt64 -> Boolle
le : UInt64 -> UInt64 -> BoolfromInt
fromInt : Int -> UInt64The UInt64 an integer wraps around to: equal to it modulo 2^64.
toInt
toInt : UInt64 -> IntrotateLeft
rotateLeft : UInt64 -> Int -> UInt64The bits turned left by n, modulo 64: those shifted out at the top
come in at the bottom, as Go’s bits.RotateLeft64 turns them; by a
negative n, right.
>>> List.map (\n -> toInt (rotateLeft 9223372036854775809 n : UInt64)) [1, -1, 64]Cons 3 (Cons 13835058055282163712 (Cons 9223372036854775809 Nil))rotateRight
rotateRight : UInt64 -> Int -> UInt64The bits turned right by n: rotateLeft x (-n).
>>> toInt (rotateRight 3 1 : UInt64)9223372036854775809popCount
popCount : UInt64 -> IntHow many of its bits are 1.
>>> List.map (\x -> popCount (x : UInt64)) [0, 7, 18446744073709551615]Cons 0 (Cons 3 (Cons 64 Nil))bitLength
bitLength : UInt64 -> IntHow many bits it needs: the place of its highest 1, from 1; of 0, 0.
>>> List.map (\x -> bitLength (x : UInt64)) [0, 1, 5, 18446744073709551615]Cons 0 (Cons 1 (Cons 3 (Cons 64 Nil)))leadingZeros
leadingZeros : UInt64 -> IntHow many 0 bits are above its highest 1: of 0, 64.
>>> List.map (\x -> leadingZeros (x : UInt64)) [0, 1, 9223372036854775808]Cons 64 (Cons 63 (Cons 0 Nil))trailingZeros
trailingZeros : UInt64 -> IntHow many 0 bits are below its lowest 1: of 0, 64.
>>> List.map (\x -> trailingZeros (x : UInt64)) [0, 1, 12, 9223372036854775808]Cons 64 (Cons 0 (Cons 2 (Cons 63 Nil)))instanceEqualityUInt64
instance instanceEqualityUInt64 : Equality UInt64instanceDebugUInt64
instance instanceDebugUInt64 : Debug UInt64>>> debug (7 : UInt64)"7"instanceShowUInt64
instance instanceShowUInt64 : Show UInt64As debug writes it.
instanceOrderUInt64
instance instanceOrderUInt64 : Order UInt64instanceAdditionUInt64
instance instanceAdditionUInt64 : Addition UInt64instanceSubtractionUInt64
instance instanceSubtractionUInt64 : Subtraction UInt64instanceMultiplicationUInt64
instance instanceMultiplicationUInt64 : Multiplication UInt64instanceDivisionUInt64
instance instanceDivisionUInt64 : Division UInt64>>> List.map debug ([7 / 2, 7 / 0] : List UInt64)Cons "3" (Cons "0" Nil)instanceRemainderUInt64
instance instanceRemainderUInt64 : Remainder UInt64>>> List.map debug ([7 % 2, 7 % 0, (7 / 0) * 0 + 7 % 0] : List UInt64)Cons "1" (Cons "7" (Cons "7" Nil))instanceNegationUInt64
instance instanceNegationUInt64 : Negation UInt64What, added to it, wraps around to 0: of 1, maxBound.
instanceIsZeroUInt64
instance instanceIsZeroUInt64 : IsZero UInt64instanceBitwiseUInt64
instance instanceBitwiseUInt64 : Bitwise UInt64The bits: shifted left by the second (modulo 64), the bits shifted out
lost, and right, zeros shifted in. The second is never negative: 0 - 1 is maxBound, a shift by which is one by 63.
>>> debug (and (shiftL 1 3 + 1) (complement 0) * 3 - 2 : UInt64)"25">>> List.map debug ([shiftL 1 (0 - 1), shiftR maxBound (0 - 1), shiftL 1 65] : List UInt64)Cons "9223372036854775808" (Cons "1" (Cons "2" Nil))