Skip to content
heff

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 -> UInt64

uint64Sub

uint64Sub : UInt64 -> UInt64 -> UInt64

uint64Mul

uint64Mul : UInt64 -> UInt64 -> UInt64

uint64Div

uint64Div : UInt64 -> UInt64 -> UInt64

uint64Rem

uint64Rem : UInt64 -> UInt64 -> UInt64

uint64Lt

uint64Lt : UInt64 -> UInt64 -> Bool

uint64Le

uint64Le : UInt64 -> UInt64 -> Bool

uint64And

uint64And : UInt64 -> UInt64 -> UInt64

uint64Or

uint64Or : UInt64 -> UInt64 -> UInt64

uint64Xor

uint64Xor : UInt64 -> UInt64 -> UInt64

uint64Shl

uint64Shl : UInt64 -> UInt64 -> UInt64

uint64Shr

uint64Shr : UInt64 -> UInt64 -> UInt64

uint64Show

uint64Show : UInt64 -> String

uint64FromInt

uint64FromInt : Int -> UInt64

uint64ToInt

uint64ToInt : UInt64 -> Int

minBound

minBound : UInt64

The least.

maxBound

maxBound : UInt64

The greatest.

add

add : UInt64 -> UInt64 -> UInt64

The sum, wrapped around: add maxBound 1 is minBound.

sub

sub : UInt64 -> UInt64 -> UInt64

mul

mul : UInt64 -> UInt64 -> UInt64

div

div : UInt64 -> UInt64 -> UInt64

Division rounding toward zero (as C’s, not as an Int’s /); by 0, 0.

rem

rem : UInt64 -> UInt64 -> UInt64

The 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 -> Bool

lt

lt : UInt64 -> UInt64 -> Bool

le

le : UInt64 -> UInt64 -> Bool

fromInt

fromInt : Int -> UInt64

The UInt64 an integer wraps around to: equal to it modulo 2^64.

toInt

toInt : UInt64 -> Int

rotateLeft

rotateLeft : UInt64 -> Int -> UInt64

The 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 -> UInt64

The bits turned right by n: rotateLeft x (-n).

>>> toInt (rotateRight 3 1 : UInt64)
9223372036854775809

popCount

popCount : UInt64 -> Int

How 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 -> Int

How 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 -> Int

How 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 -> Int

How 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 UInt64

instanceDebugUInt64

instance instanceDebugUInt64 : Debug UInt64
>>> debug (7 : UInt64)
"7"

instanceShowUInt64

instance instanceShowUInt64 : Show UInt64

As debug writes it.

instanceOrderUInt64

instance instanceOrderUInt64 : Order UInt64

instanceAdditionUInt64

instance instanceAdditionUInt64 : Addition UInt64

instanceSubtractionUInt64

instance instanceSubtractionUInt64 : Subtraction UInt64

instanceMultiplicationUInt64

instance instanceMultiplicationUInt64 : Multiplication UInt64

instanceDivisionUInt64

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 UInt64

What, added to it, wraps around to 0: of 1, maxBound.

instanceIsZeroUInt64

instance instanceIsZeroUInt64 : IsZero UInt64

instanceBitwiseUInt64

instance instanceBitwiseUInt64 : Bitwise UInt64

The 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))