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 -> Int8int8Sub
int8Sub : Int8 -> Int8 -> Int8int8Mul
int8Mul : Int8 -> Int8 -> Int8int8Div
int8Div : Int8 -> Int8 -> Int8int8Rem
int8Rem : Int8 -> Int8 -> Int8int8Lt
int8Lt : Int8 -> Int8 -> Boolint8Le
int8Le : Int8 -> Int8 -> Boolint8And
int8And : Int8 -> Int8 -> Int8int8Or
int8Or : Int8 -> Int8 -> Int8int8Xor
int8Xor : Int8 -> Int8 -> Int8int8Shl
int8Shl : Int8 -> Int8 -> Int8int8Shr
int8Shr : Int8 -> Int8 -> Int8int8Show
int8Show : Int8 -> Stringint8FromInt
int8FromInt : Int -> Int8int8ToInt
int8ToInt : Int8 -> IntminBound
minBound : Int8The least.
maxBound
maxBound : Int8The greatest.
add
add : Int8 -> Int8 -> Int8The sum, wrapped around: add maxBound 1 is minBound.
sub
sub : Int8 -> Int8 -> Int8mul
mul : Int8 -> Int8 -> Int8div
div : Int8 -> Int8 -> Int8Division 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 -> Int8The 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 -> Boollt
lt : Int8 -> Int8 -> Boolle
le : Int8 -> Int8 -> BoolfromInt
fromInt : Int -> Int8The Int8 an integer wraps around to: equal to it modulo 2^8.
toInt
toInt : Int8 -> IntinstanceEqualityInt8
instance instanceEqualityInt8 : Equality Int8instanceDebugInt8
instance instanceDebugInt8 : Debug Int8>>> debug (7 : Int8)"7"instanceShowInt8
instance instanceShowInt8 : Show Int8As debug writes it.
instanceOrderInt8
instance instanceOrderInt8 : Order Int8instanceAdditionInt8
instance instanceAdditionInt8 : Addition Int8instanceSubtractionInt8
instance instanceSubtractionInt8 : Subtraction Int8instanceMultiplicationInt8
instance instanceMultiplicationInt8 : Multiplication Int8instanceDivisionInt8
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 Int8The integer of the other sign, wrapped around: of minBound, itself.
instanceIsZeroInt8
instance instanceIsZeroInt8 : IsZero Int8instanceBitwiseInt8
instance instanceBitwiseInt8 : Bitwise Int8The 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)))