Documentation

Learn Coil, then look things up.

Two halves: a tutorial that builds the language up one chapter at a time, and a reference to come back to for exact rules and APIs.

Learn

The tutorial

Start from installation and a first program, then work through 16 chapters — types, collections, classes, errors, traits, modules, IO, testing, tasks, threads, macros and C.

Start with Getting started →
Reference

The reference

802 pages of precise lookup: a page for every module, type and function, plus grammar, the type system, operators, keywords and error codes.

Open the reference index →
Packages

The ecosystem

Docs for spool, coil-stdlib and every library — JSON, TOML, HTTP, TLS and more — in the same place as the language.

Browse packages →
Learn

A guided path, in order

Each chapter builds on the one before. Read them in sequence the first time.

  1. 01 Basics Printing, variables, functions, if and loops.
  2. 02 Types & variables Built-in types, inference, as, strings, tuples, records, constants.
  3. 03 Collections Arrays, Vec, maps and sets; sorting, mapping, filtering.
  4. 04 Classes Fields, methods, pub, static functions, derive, generic classes.
  5. 05 Enums & match Cases with data, match, Option, if let.
  6. 06 Error handling Result, raise, ?, ?? and panic.
  7. 07 Traits & generics Generic functions, bounds, your own traits, trait-typed values.
  8. 08 Functions as values Lambdas, use (…) captures, returning functions, partial application.
  9. 09 Modules & packages Files as modules, use, and packages with spool.
  10. 10 Files & IO The terminal, files, directories, arguments and permissions.
  11. 11 Testing test blocks, assert!, doc examples and contracts.
  12. 12 Generators gen fn, yield, lazy sequences and pipelines.
  13. 13 Tasks Concurrent IO on one thread: scopes, channels, timeouts.
  14. 14 Threads Parallel CPU work: spawn, join, channels, mutexes.
  15. 15 Macros name!(…), #[attr(…)] and #[derive(…)]: code that writes code.
  16. 16 Calling C extern blocks, dload and the flags that allow a library.
Reference

Look it up

Organised by what you are looking for — not the order you learn it.

Language

Grammar, type system and the rules the compiler enforces.

Prelude & primitives

In scope in every file, no `use` needed.

Compiler modules

Shipped with the compiler; import what you use.

Standard library

coil-stdlib: collections, text, numbers, blocking IO.

Packages

Package docs

Synced from each package's repository, alongside the manifest and lockfile reference for spool.

spool

The package manager: commands, manifest and lockfile.

coil-stdlib

The userland standard library.

json

JSON and JSONC.

toml

TOML 1.0.

msgpack

MessagePack.

http

HTTP client and server.

tls

TLS streams on rustls.

crypto

Hashing and secure randomness.

regex

PCRE2 regular expressions.

deflate

DEFLATE compression.

time

Calendar and monotonic time.

greet (example)

A minimal package consumed via spool.

Beyond the docs

Read real code

↑ ↓ navigate ↵ open