int16
Int16: the integers from -32768 to 32767, wrapping around as the
machine’s do (two’s complement): fromInt 32768 is -32768. A literal checked at Int16 is one ((7 : Int16)).
Import it by a name, import int16 as Int16, as the other fixed-width
types’ modules have the same names: Int16.fromInt, Int16.minBound. None
of them is the prelude’s: its instances are the prelude’s operators
and functions at Int16, 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.)
int16Add
int16Add : Int16 -> Int16 -> Int16int16Sub
int16Sub : Int16 -> Int16 -> Int16int16Mul
int16Mul : Int16 -> Int16 -> Int16int16Div
int16Div : Int16 -> Int16 -> Int16int16Rem
int16Rem : Int16 -> Int16 -> Int16int16Lt
int16Lt : Int16 -> Int16 -> Boolint16Le
int16Le : Int16 -> Int16 -> Boolint16And
int16And : Int16 -> Int16 -> Int16int16Or
int16Or : Int16 -> Int16 -> Int16int16Xor
int16Xor : Int16 -> Int16 -> Int16int16Shl
int16Shl : Int16 -> Int16 -> Int16int16Shr
int16Shr : Int16 -> Int16 -> Int16int16Show
int16Show : Int16 -> Stringint16FromInt
int16FromInt : Int -> Int16int16ToInt
int16ToInt : Int16 -> IntminBound
minBound : Int16The least.
maxBound
maxBound : Int16The greatest.
add
add : Int16 -> Int16 -> Int16The sum, wrapped around: add maxBound 1 is minBound.
sub
sub : Int16 -> Int16 -> Int16mul
mul : Int16 -> Int16 -> Int16div
div : Int16 -> Int16 -> Int16Division 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 : Int16 -> Int16 -> Int16The 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 : Int16 -> Int16 -> Boollt
lt : Int16 -> Int16 -> Boolle
le : Int16 -> Int16 -> BoolfromInt
fromInt : Int -> Int16The Int16 an integer wraps around to: equal to it modulo 2^16.
toInt
toInt : Int16 -> IntinstanceEqualityInt16
instance instanceEqualityInt16 : Equality Int16instanceDebugInt16
instance instanceDebugInt16 : Debug Int16>>> debug (7 : Int16)"7"instanceShowInt16
instance instanceShowInt16 : Show Int16As debug writes it.
instanceOrderInt16
instance instanceOrderInt16 : Order Int16instanceAdditionInt16
instance instanceAdditionInt16 : Addition Int16instanceSubtractionInt16
instance instanceSubtractionInt16 : Subtraction Int16instanceMultiplicationInt16
instance instanceMultiplicationInt16 : Multiplication Int16instanceDivisionInt16
instance instanceDivisionInt16 : Division Int16>>> List.map debug ([7 / 2, -7 / 2, 7 / 0, minBound / -1] : List Int16)Cons "3" (Cons "-3" (Cons "0" (Cons "-32768" Nil)))instanceRemainderInt16
instance instanceRemainderInt16 : Remainder Int16>>> List.map debug ([7 % 2, -7 % 2, 7 % 0, minBound % -1, (7 / 0) * 0 + 7 % 0] : List Int16)Cons "1" (Cons "-1" (Cons "7" (Cons "0" (Cons "7" Nil))))instanceNegationInt16
instance instanceNegationInt16 : Negation Int16The integer of the other sign, wrapped around: of minBound, itself.
instanceIsZeroInt16
instance instanceIsZeroInt16 : IsZero Int16instanceBitwiseInt16
instance instanceBitwiseInt16 : Bitwise Int16The bits, as two’s complement has them: shifted left by the second
(modulo 16), 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 : Int16)"25"