Skip to content
heff

int8

Int8: the integers from -128 to 127, wrapping around as the machine’s do (two’s complement): fromInt 128 is -128. A literal checked at Int8 is one ((7 : Int8)). Import it by a name, import int8 as Int8, as the other fixed-width types’ modules have the same names: Int8.fromInt, Int8.minBound. None of them is the prelude’s: its instances are the prelude’s operators and functions at Int8, 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.)

int8Add

int8Add : Int8 -> Int8 -> Int8

int8Sub

int8Sub : Int8 -> Int8 -> Int8

int8Mul

int8Mul : Int8 -> Int8 -> Int8

int8Div

int8Div : Int8 -> Int8 -> Int8

int8Rem

int8Rem : Int8 -> Int8 -> Int8

int8Lt

int8Lt : Int8 -> Int8 -> Bool

int8Le

int8Le : Int8 -> Int8 -> Bool

int8And

int8And : Int8 -> Int8 -> Int8

int8Or

int8Or : Int8 -> Int8 -> Int8

int8Xor

int8Xor : Int8 -> Int8 -> Int8

int8Shl

int8Shl : Int8 -> Int8 -> Int8

int8Shr

int8Shr : Int8 -> Int8 -> Int8

int8Show

int8Show : Int8 -> String

int8FromInt

int8FromInt : Int -> Int8

int8ToInt

int8ToInt : Int8 -> Int

minBound

minBound : Int8

The least.

maxBound

maxBound : Int8

The greatest.

add

add : Int8 -> Int8 -> Int8

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

sub

sub : Int8 -> Int8 -> Int8

mul

mul : Int8 -> Int8 -> Int8

div

div : Int8 -> Int8 -> Int8

Division rounding toward zero (as C’s, not as an Int’s /); by 0, 0. By -1 it is a negation, wrapping around: of minBound, itself.

rem

rem : Int8 -> Int8 -> Int8

The remainder of div, of the sign of the dividend; by 0, the dividend, so that add (mul (div x y) y) (rem x y) is x whatever y is.

eq

eq : Int8 -> Int8 -> Bool

lt

lt : Int8 -> Int8 -> Bool

le

le : Int8 -> Int8 -> Bool

fromInt

fromInt : Int -> Int8

The Int8 an integer wraps around to: equal to it modulo 2^8.

toInt

toInt : Int8 -> Int

instanceEqualityInt8

instance instanceEqualityInt8 : Equality Int8

instanceDebugInt8

instance instanceDebugInt8 : Debug Int8
>>> debug (7 : Int8)
"7"

instanceShowInt8

instance instanceShowInt8 : Show Int8

As debug writes it.

instanceOrderInt8

instance instanceOrderInt8 : Order Int8

instanceAdditionInt8

instance instanceAdditionInt8 : Addition Int8

instanceSubtractionInt8

instance instanceSubtractionInt8 : Subtraction Int8

instanceMultiplicationInt8

instance instanceMultiplicationInt8 : Multiplication Int8

instanceDivisionInt8

instance instanceDivisionInt8 : Division Int8
>>> List.map debug ([7 / 2, -7 / 2, 7 / 0, minBound / -1] : List Int8)
Cons "3" (Cons "-3" (Cons "0" (Cons "-128" Nil)))

instanceRemainderInt8

instance instanceRemainderInt8 : Remainder Int8
>>> List.map debug ([7 % 2, -7 % 2, 7 % 0, minBound % -1, (7 / 0) * 0 + 7 % 0] : List Int8)
Cons "1" (Cons "-1" (Cons "7" (Cons "0" (Cons "7" Nil))))

instanceNegationInt8

instance instanceNegationInt8 : Negation Int8

The integer of the other sign, wrapped around: of minBound, itself.

instanceIsZeroInt8

instance instanceIsZeroInt8 : IsZero Int8

instanceBitwiseInt8

instance instanceBitwiseInt8 : Bitwise Int8

The bits, as two’s complement has them: shifted left by the second (modulo 8), the bits shifted out lost, and right, the sign copied in; by a negative second, the other way (shiftL x -n is shiftR x n).

>>> debug (and (shiftL 1 3 + 1) (complement 0) * 3 - 2 : Int8)
"25"
>>> List.map debug ([shiftL 3 -1, shiftR 3 -2, shiftL -128 -9, shiftL 1 9] : List Int8)
Cons "1" (Cons "12" (Cons "-64" (Cons "2" Nil)))