Skip to main content

Cookbook

Short, focused recipes for the things you actually do. Each recipe is self-contained — copy it into your project as a starting point.

Looking for longer guided builds? See Tutorials.

Getting data in

Talking to the world

  • HTTP client — typed responses, retries, TLS config.
  • HTTP server — minimal typed server with routing, context-based DI, and test mocks.
  • TCP sockets — echo server, framing, half-close handling.
  • DNS lookups — A/AAAA records, SRV, MX, timeouts.

Running code

Collections & state

Types that prove things

Memory

Metaprogramming

Systems

  • CLI tool — argument parsing, subcommands, config files, coloured errors, exit codes.
  • TUI with the Elm loop — 7-layer terminal framework, scenes, event handling.
  • FFI — calling C libraries, boundary contracts, ownership transfer.

See also

  • Tutorials — longer end-to-end builds for a URL shortener, parser combinator, verified data structure, ETL pipeline, and MNIST classifier.
  • Guides — FAQ, performance, security, troubleshooting.