Arbitrary-precision integers for EVM applications.
Supports the full uint256 range (0 to 2^256-1) and int256 range. Implemented as a base-10^7 digit list with no external dependencies.
All values crossing the port boundary are decimal strings — this module handles the conversion safely.
Parse a decimal integer string. Returns Nothing for invalid input.
Accepts optional leading '-' or '+' sign. Rejects empty strings, non-digit characters, and floating-point notation.
fromString "0" == Just zero
fromString "-42" == Just (fromInt -42)
fromString "115792...9935" -- uint256 max: Just <big>
fromString "abc" == Nothing
fromString "" == NothingAlias for fromString (decimal). Kept for API symmetry with fromHexString.
Parse a 0x-prefixed hexadecimal string as a non-negative BigInt. Returns Nothing for invalid input or empty hex body.
fromHexString "0x64" == Just (fromInt 100)
fromHexString "0xFF" == Just (fromInt 255)
fromHexString "0x" == Nothing
fromHexString "0xgg" == NothingConvert a non-negative BigInt to a lower-case hexadecimal string
without a "0x" prefix or leading zeros.
Returns "0" for zero. For negative integers, the sign is dropped and the
absolute value is rendered — callers needing two's-complement should do the
twiddling themselves (or use Web3.Abi.Calldata.int256).
toHexString (fromInt 0) == "0"
toHexString (fromInt 255) == "ff"
toHexString (fromInt 65535) == "ffff"Remainder: a mod b. Returns Nothing if b is zero.
mod (fromInt 10) (fromInt 3) == Just (fromInt 1)
mod (fromInt 10) zero == Nothing
An arbitrary-precision integer.