0x0 API Reference

lib/core/bytes.0x0

Module: core.bytes

bytes-empty

Type: (∷ (→ Unit Any))

Create an empty byte list.

bytes-abi-v1?

Type: (∷ (→ Any Bool))

Return true when value uses the ABI v1 Bytes layout.

bytes-raw

Type: (∷ (→ Any Any))

Return the raw byte list from ABI v1 or v0.1 byte values.

bytes-from-raw

Type: (∷ (→ Any Any))

Create an ABI v1 Bytes value from a raw byte list.

byte-valid?

Type: (∷ (→ I64 Bool))

Return true when n fits in one unsigned byte.

bytes-cons

Type: (∷ (→ I64 Any Any))

Prepend a byte to a byte list.

bytes-try-cons

Type: (∷ (→ I64 Any Any))

Return a Result containing byte prepended to rest.

bytes-len

Type: (∷ (→ Any I64))

Return the number of bytes.

bytes-at

Type: (∷ (→ Any I64 I64))

Return the byte at index.

bytes-sum

Type: (∷ (→ Any I64))

Return the sum of all bytes.

bytes-sum-raw

Type: (∷ (→ Any I64))

Return the sum of a raw byte list.

byte-to-hex

Type: (∷ (→ I64 Text))

Return a two-digit lowercase hexadecimal representation of a byte.

bytes-to-hex

Type: (∷ (→ Any Text))

Return lowercase hexadecimal text for a byte list.

bytes-raw-to-hex

Type: (∷ (→ Any Text))

Return lowercase hexadecimal text for a raw byte list.

hex-to-bytes

Type: (∷ (→ Text Any))

Decode lowercase or uppercase hexadecimal text into a byte-list Result.

hex-even-length?

Type: (∷ (→ Text I64 I64 Bool))

Return true when the remaining text length is even.

hex-to-bytes-from

Type: (∷ (→ Text I64 I64 Any))

Decode hexadecimal text from an offset into a byte-list Result.

hex-digit

Type: (∷ (→ I64 Text))

Return a lowercase hexadecimal digit for values 0 through 15.

hex-char-value

Type: (∷ (→ Text I64))

Return a hexadecimal character value or -1 when invalid.

hex-char-value-from

Type: (∷ (→ Text Text I64 I64))

Return the index of a hexadecimal character in digits or -1.

lib/core/db.0x0

Module: core.db

db-empty

Type: (∷ (→ Unit Any))

Create an empty table.

db-row

Type: (∷ (→ Text Any Any))

Create a one-field row.

db-row-put

Type: (∷ (→ Any Text Any Any))

Return row with key set to value.

db-insert

Type: (∷ (→ Any Any Any))

Return table with row inserted at the front.

db-count

Type: (∷ (→ Any I64))

Return the number of rows in a table.

db-cell

Type: (∷ (→ Any Text Any))

Return an Option containing a row cell.

db-cell-text-or

Type: (∷ (→ Any Text Text Text))

Return a text cell or a fallback value.

db-find-text

Type: (∷ (→ Any Text Text Any))

Return an Option row whose text cell matches value.

db-update-text

Type: (∷ (→ Any Text Text Text Text Any))

Update the first row with matching text cell.

lib/core/error.0x0

Module: core.error

error-new

Type: (∷ (→ Text Text Any))

Create a structured error value.

error-abi-v1?

Type: (∷ (→ Any Bool))

Return true when value uses the ABI v1 Error layout.

error-code

Type: (∷ (→ Any Text))

Return an error code.

error-message

Type: (∷ (→ Any Text))

Return an error message.

error-text

Type: (∷ (→ Any Text))

Render an error as text.

error-result

Type: (∷ (→ Any Any))

Convert an error to a failed Result.

lib/core/file.0x0

Module: core.file

file-read-safe

Type: (∷ (→ Text Any))

Read a safe relative file path into a Result. Requires cap file. Unsafe paths return err unsafe-path; success returns ok with file text.

file-write-safe

Type: (∷ (→ Text Text Any))

Write text to a safe relative file path and return a Result. Requires cap file. Unsafe paths return err unsafe-path; success returns ok Unit.

lib/core/json.0x0

Module: core.json

json-get-int

Type: (∷ (→ Text Text Any))

Return an integer field from a flat JSON object as an Option.

json-get-text

Type: (∷ (→ Text Text Any))

Return an unescaped text field from a flat JSON object as an Option.

json-get-bool

Type: (∷ (→ Text Text Any))

Return a boolean field from a flat JSON object as an Option.

json-find-pattern

Type: (∷ (→ Text Text I64 I64 I64 I64))

Return the first index of pattern in src or -1.

json-value-start

Type: (∷ (→ Text I64 I64 I64))

Return the first non-space character after a field colon.

json-skip-space

Type: (∷ (→ Text I64 I64 I64))

Skip JSON whitespace.

json-int-end

Type: (∷ (→ Text I64 I64 I64))

Return the end offset of a JSON integer literal.

json-int-token?

Type: (∷ (→ Text I64 I64 Bool))

Return true when start points at a syntactically valid integer token.

json-string-token?

Type: (∷ (→ Text I64 I64 Bool))

Return true when start points at a quoted JSON text token with a closing quote.

json-bool-token?

Type: (∷ (→ Text I64 I64 Bool))

Return true when start points at a syntactically valid boolean token.

json-value-tail?

Type: (∷ (→ Text I64 I64 Bool))

Return true when a scalar JSON token is followed by whitespace, comma, object end, or EOF.

json-digits-end

Type: (∷ (→ Text I64 I64 I64))

Return the end offset of a run of digits.

json-string-end

Type: (∷ (→ Text I64 I64 I64))

Return the end offset of an unescaped JSON string value.

lib/core/map.0x0

Module: core.map

map-empty

Type: (∷ (→ Unit Any))

Create an empty text-key map.

map-entry

Type: (∷ (→ Text Any Any))

Create a key/value map entry.

map-abi-v1?

Type: (∷ (→ Any Bool))

Return true when value uses the ABI v1 Map layout.

map-entries

Type: (∷ (→ Any Any))

Return raw map entries from ABI v1 or v0.1 map values.

map-entry-abi-v1?

Type: (∷ (→ Any Bool))

Return true when value uses the ABI v1 map entry layout.

map-entry-key

Type: (∷ (→ Any Text))

Return a map entry key.

map-entry-value

Type: (∷ (→ Any Any))

Return a map entry value.

map-put

Type: (∷ (→ Any Text Any Any))

Return a map with key set to value.

map-put-entries

Type: (∷ (→ Any Text Any Any))

Return raw map entries with key set to value.

map-get

Type: (∷ (→ Any Text Any))

Return an Option containing the value for key.

map-get-entries

Type: (∷ (→ Any Text Any))

Return an Option containing the value for key from raw entries.

map-has?

Type: (∷ (→ Any Text Bool))

Return true when key exists in the map.

map-remove

Type: (∷ (→ Any Text Any))

Return a map without key.

map-remove-entries

Type: (∷ (→ Any Text Any))

Return raw map entries without key.

lib/core/option.0x0

Module: core.option

option-none

Type: (∷ (→ Unit Any))

Create an ABI v1 absent Option. Parameter is Unit. Returns the none variant. Pure; no errors or host side effects.

option-some

Type: (∷ (→ Any Any))

Create an ABI v1 present Option containing value. Pure; does not validate or copy the payload.

option-abi-v1?

Type: (∷ (→ Any Bool))

Return true when value uses the ABI v1 Option layout marker. Pure; empty lists return false.

option-some?

Type: (∷ (→ Any Bool))

Return true when an Option is the some variant. Accepts ABI v1 and legacy Option layouts.

option-none?

Type: (∷ (→ Any Bool))

Return true when an Option is the none variant. Accepts ABI v1 and legacy Option layouts.

option-value

Type: (∷ (→ Any Any))

Return the Option payload. Panics with option-value called on none when the value is absent. Accepts ABI v1 and legacy layouts.

option-value-or

Type: (∷ (→ Any Any Any))

Return the Option payload when present, otherwise fallback. Pure; fallback is returned unchanged.

lib/core/path.0x0

Module: core.path

path-empty?

Type: (∷ (→ Text Bool))

Return true when path is empty.

path-absolute?

Type: (∷ (→ Text Bool))

Return true when path is absolute.

path-parent-traversal?

Type: (∷ (→ Text Bool))

Return true when path contains parent traversal.

path-safe-relative?

Type: (∷ (→ Text Bool))

Return true when path is a safe relative path.

path-join

Type: (∷ (→ Text Text Text))

Join base and leaf path with one slash.

path-contains?

Type: (∷ (→ Text Text Bool))

Return true when haystack contains needle.

path-contains-from?

Type: (∷ (→ Text Text I64 I64 I64 Bool))

Recursive implementation for substring search.

path-starts-with?

Type: (∷ (→ Text Text Bool))

Return true when s starts with prefix.

path-ends-with?

Type: (∷ (→ Text Text Bool))

Return true when s ends with suffix.

lib/core/result.0x0

Module: core.result

result-ok

Type: (∷ (→ Any Any))

Create an ABI v1 successful Result containing value. Pure; does not validate or copy the payload.

result-err

Type: (∷ (→ Text Text Any))

Create an ABI v1 failed Result with a structured Error code and message. Pure; details are Unit and evidence is empty.

result-abi-v1?

Type: (∷ (→ Any Bool))

Return true when value uses the ABI v1 Result layout marker. Pure; empty lists return false.

result-ok?

Type: (∷ (→ Any Bool))

Return true when a Result is the ok variant. Accepts ABI v1 and legacy Result layouts.

result-err?

Type: (∷ (→ Any Bool))

Return true when a Result is the err variant. Accepts ABI v1 and legacy Result layouts.

result-value

Type: (∷ (→ Any Any))

Return the Result success payload. Panics with code and message text when result is failed. Accepts ABI v1 and legacy layouts.

result-value-or

Type: (∷ (→ Any Any Any))

Return the Result success payload when ok, otherwise fallback. Pure; fallback is returned unchanged.

result-error-code

Type: (∷ (→ Any Text))

Return the error code from a failed Result. Precondition: result is err; behavior for ok is not specified by this helper.

result-error-message

Type: (∷ (→ Any Text))

Return the error message from a failed Result. Precondition: result is err; behavior for ok is not specified by this helper.