Module

Wasm.Int

Package
purescript-wasm-base
Repository
purs-wasm/purescript-wasm-base

WasmBase Wasm.Int (ADR 0026/0028): first-order Int primitives, so WasmBase modules — and ulib shadows of low-level prelude modules (e.g. Data.Functor, which imports no arithmetic) — can run without Prelude (which would be circular). Types are Prim; the operations resolve to intrinsics on wasm (Intrinsics.qualifiedIntrinsicWasm.Int.*) and to Wasm/Int.js on the JS backends.

#add Source

add :: Int -> Int -> Int

#sub Source

sub :: Int -> Int -> Int

#mul Source

mul :: Int -> Int -> Int

#eq Source

eq :: Int -> Int -> Boolean

#lt Source

lt :: Int -> Int -> Boolean

Signed less-than. On wasm: the IntLt intrinsic (i32.lt_s).

#div Source

div :: Int -> Int -> Int

Euclidean integer division / remainder (matching Prelude's Int EuclideanRing: non-negative remainder, 0 when the divisor is 0). On wasm: the IntDiv / IntMod intrinsics. For the non-negative operands the shadows use these on, they are ordinary quotient / remainder.

#mod Source

mod :: Int -> Int -> Int