Skip to main content

Int

Integer numbers

Most operations on integers (e.g. addition) are available as built-in operators (e.g. 1 + 1). This module provides equivalent functions and Text conversion.

Int

type Int = Prim.Types.Int

Infinite precision signed integers.

abs

let abs : Int -> Nat

Returns the absolute value of the number

toText

let toText : Int -> Text

Conversion.

min

func min(x : Int, y : Int) : Int

Returns the minimum of x and y.

max

func max(x : Int, y : Int) : Int

Returns the maximum of x and y.

hash

func hash(i : Int) : Hash.Hash

hashAcc

func hashAcc(h1 : Hash.Hash, i : Int) : Hash.Hash

May go away (?)

equal

func equal(x : Int, y : Int) : Bool

Returns x == y.

notEqual

func notEqual(x : Int, y : Int) : Bool

Returns x != y.

less

func less(x : Int, y : Int) : Bool

Returns x < y.

lessOrEqual

func lessOrEqual(x : Int, y : Int) : Bool

Returns x ⇐ y.

greater

func greater(x : Int, y : Int) : Bool

Returns x > y.

greaterOrEqual

func greaterOrEqual(x : Int, y : Int) : Bool

Returns x >= y.

compare

func compare(x : Int, y : Int) : {#less; #equal; #greater}

Returns the order of x and y.

neq

func neq(x : Int) : Int

Returns the negation of x, -x .

add

func add(x : Int, y : Int) : Int

Returns the sum of x and y, x + y.

sub

func sub(x : Int, y : Int) : Int

Returns the difference of x and y, x - y.

mul

func mul(x : Int, y : Int) : Int

Returns the product of x and y, x * y.

div

func div(x : Int, y : Int) : Int

Returns the division of x by y, x / y. Traps when y is zero.

rem

func rem(x : Int, y : Int) : Int

Returns the remainder of x divided by y, x % y. Traps when y is zero.

pow

func pow(x : Int, y : Int) : Int

Returns x to the power of y, x ** y.