Skip to content
heff

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

int32Sub

int32Sub : Int32 -> Int32 -> Int32

int32Mul

int32Mul : Int32 -> Int32 -> Int32

int32Div

int32Div : Int32 -> Int32 -> Int32

int32Rem

int32Rem : Int32 -> Int32 -> Int32

int32Lt

int32Lt : Int32 -> Int32 -> Bool

int32Le

int32Le : Int32 -> Int32 -> Bool

int32And

int32And : Int32 -> Int32 -> Int32

int32Or

int32Or : Int32 -> Int32 -> Int32

int32Xor

int32Xor : Int32 -> Int32 -> Int32

int32Shl

int32Shl : Int32 -> Int32 -> Int32

int32Shr

int32Shr : Int32 -> Int32 -> Int32

int32Show

int32Show : Int32 -> String

int32FromInt

int32FromInt : Int -> Int32

int32ToInt

int32ToInt : Int32 -> Int

minBound

minBound : Int32

The least.

maxBound

maxBound : Int32

The greatest.

add

add : Int32 -> Int32 -> Int32

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

sub

sub : Int32 -> Int32 -> Int32

mul

mul : Int32 -> Int32 -> Int32

div

div : Int32 -> Int32 -> Int32

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 : Int32 -> Int32 -> Int32

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 : Int32 -> Int32 -> Bool

lt

lt : Int32 -> Int32 -> Bool

le

le : Int32 -> Int32 -> Bool

fromInt

fromInt : Int -> Int32

The Int32 an integer wraps around to: equal to it modulo 2^32.

toInt

toInt : Int32 -> Int

instanceEqualityInt32

instance instanceEqualityInt32 : Equality Int32

instanceDebugInt32

instance instanceDebugInt32 : Debug Int32
>>> debug (7 : Int32)
"7"

instanceShowInt32

instance instanceShowInt32 : Show Int32

As debug writes it.

instanceOrderInt32

instance instanceOrderInt32 : Order Int32

instanceAdditionInt32

instance instanceAdditionInt32 : Addition Int32

instanceSubtractionInt32

instance instanceSubtractionInt32 : Subtraction Int32

instanceMultiplicationInt32

instance instanceMultiplicationInt32 : Multiplication Int32

instanceDivisionInt32

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 Int32

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

instanceIsZeroInt32

instance instanceIsZeroInt32 : IsZero Int32

instanceBitwiseInt32

instance instanceBitwiseInt32 : Bitwise Int32

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