Skip to content
Menu

Documentation

Every module is preloaded: use its exports qualified (List.map), with no import. The core and component targets each preload their own host package, so WasiCli is in both, with its own page in each.

Standard library

11 modules

Numbers, text, bytes, lists and results, and the core target's command line and environment.

  • Bitwise

    Bit operations on an Int, read as a 64-bit two's-complement word.

  • Bool

    Functions on Bool.

  • Bytes

    A sequence of arbitrary bytes, @Bytes, with no promise that they are text.

  • File

    What every file implementation shares: the errors a file operation reports, the entries a directory lists, and pure functions over /-separated paths.

  • Float

    64-bit IEEE 754 floating-point numbers.

  • Int

    64-bit signed integers.

  • List

    Functions on List(a), the singly linked list.

  • Never

    The empty type's one function.

  • Result

    Working with Results, the [Ok(a) | Err(e)] variant that fallible functions return.

  • String

    Functions on Strings, which are UTF-8 byte sequences.

  • UTF8

    Reading a String as UTF-8 text rather than bytes.

HTTP

2 modules

Requests, responses and URIs as plain data, so a handler is a pure function that runs under either server.

  • Http

    HTTP requests and responses, methods, headers, cookies and Basic authentication, as pure values and functions over them.

  • Uri

    The URI pieces Http needs: query strings, percent-encoding and path segments.

JSON

1 module

Parsing, encoding and decoding JSON on either target.

  • Json

    JSON (RFC 8259) values: parsing, encoding, and decoding into Bert values.

WASI preview 1

2 modulescore target

The core target's host modules, over WASI preview 1.

  • WasiCli

    Reading and writing a command-line program's standard streams, its arguments, its environment variables, and its exit, for a WASI preview1 host.

  • WasiClock

    The host's clocks, read in nanoseconds.

WASI

5 modulescomponent target

The component target's command line, streams, HTTP server and files, over WASI 0.2.

  • WasiCli

    The component target's command line: printing, reading stdin, arguments, environment variables and exiting over the WASI 0.2 CLI interfaces.

  • WasiClock

    The host's clocks, read in nanoseconds, over wasi:clocks.

  • WasiFile

    File access for the component target, over wasi:filesystem: whole-file reads and writes, directory listings and one-level directory changes, in File's types.

  • WasiHttp

    The component target's HTTP server: serve runs an Http handler as a wasi:http/incoming-handler export, over the wasi:http/types views below.

  • WasiIo

    The wasi:io streams, errors and pollables WASI 0.2 interfaces pass around, shared by WasiCli and the other wasip2 modules that read and write streams.