int32
Int32: the integers from -2147483648 to 2147483647, wrapping around as the
machine’s do (two’s complement): fromInt 2147483648 is -2147483648. A literal checked at Int32 is one ((7 : Int32)).
Import it by a name, import int32 as Int32, as the other fixed-width
types’ modules have the same names: Int32.fromInt, Int32.minBound. None
of them is the prelude’s: its instances are the prelude’s operators
and functions at Int32, 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.)
int32Add
int32Add : Int32 -> Int32 -> Int32int32Sub
int32Sub : Int32 -> Int32 -> Int32int32Mul
int32Mul : Int32 -> Int32 -> Int32int32Div
int32Div : Int32 -> Int32 -> Int32int32Rem
int32Rem : Int32 -> Int32 -> Int32int32Lt
int32Lt : Int32 -> Int32 -> Boolint32Le
int32Le : Int32 -> Int32 -> Boolint32And
int32And : Int32 -> Int32 -> Int32int32Or
int32Or : Int32 -> Int32 -> Int32int32Xor
int32Xor : Int32 -> Int32 -> Int32int32Shl
int32Shl : Int32 -> Int32 -> Int32int32Shr
int32Shr : Int32 -> Int32 -> Int32int32Show
int32Show : Int32 -> Stringint32FromInt
int32FromInt : Int -> Int32int32ToInt
int32ToInt : Int32 -> IntminBound
minBound : Int32The least.
maxBound
maxBound : Int32The greatest.
add
add : Int32 -> Int32 -> Int32The sum, wrapped around: add maxBound 1 is minBound.
sub
sub : Int32 -> Int32 -> Int32mul
mul : Int32 -> Int32 -> Int32div
div : Int32 -> Int32 -> Int32Division 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 : Int32 -> Int32 -> Int32The 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 : Int32 -> Int32 -> Boollt
lt : Int32 -> Int32 -> Boolle
le : Int32 -> Int32 -> BoolfromInt
fromInt : Int -> Int32The Int32 an integer wraps around to: equal to it modulo 2^32.
toInt
toInt : Int32 -> IntinstanceEqualityInt32
instance instanceEqualityInt32 : Equality Int32instanceDebugInt32
instance instanceDebugInt32 : Debug Int32>>> debug (7 : Int32)"7"instanceShowInt32
instance instanceShowInt32 : Show Int32As debug writes it.
instanceOrderInt32
instance instanceOrderInt32 : Order Int32instanceAdditionInt32
instance instanceAdditionInt32 : Addition Int32instanceSubtractionInt32
instance instanceSubtractionInt32 : Subtraction Int32instanceMultiplicationInt32
instance instanceMultiplicationInt32 : Multiplication Int32instanceDivisionInt32
instance instanceDivisionInt32 : Division Int32>>> List.map debug ([7 / 2, -7 / 2, 7 / 0, minBound / -1] : List Int32)Cons "3" (Cons "-3" (Cons "0" (Cons "-2147483648" Nil)))instanceRemainderInt32
instance instanceRemainderInt32 : Remainder Int32>>> List.map debug ([7 % 2, -7 % 2, 7 % 0, minBound % -1, (7 / 0) * 0 + 7 % 0] : List Int32)Cons "1" (Cons "-1" (Cons "7" (Cons "0" (Cons "7" Nil))))instanceNegationInt32
instance instanceNegationInt32 : Negation Int32The integer of the other sign, wrapped around: of minBound, itself.
instanceIsZeroInt32
instance instanceIsZeroInt32 : IsZero Int32instanceBitwiseInt32
instance instanceBitwiseInt32 : Bitwise Int32The bits, as two’s complement has them: shifted left by the second
(modulo 32), 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 : Int32)"25"