Sn Tin

A tour of Tin

Eight short chapters. Every code block is a real file from examples/, and every output is what the test suite checks. Already know Python or TypeScript? Here's the cheat sheet.

  1. 01 Hello, TinA program is a file with a main. Strings interpolate, and everything is an expression.
  2. 02 Structs and sum typesData is described with type. A sum type lists every shape a value can take, and match must handle all of them. Every value is copied, never shared.
  3. 03 No null, no exceptionsA value that may be missing is an Option. An operation that may fail returns a Result. ? passes the failure up.
  4. 04 Functions, pipelines and closuresx |> f(y) means f(x, y), and so does x.f(y). Use whichever reads better.
  5. 05 GenericsGeneric code is specialised at compile time. Stack<int> and Stack<string> become separate WebAssembly functions.
  6. 06 Concurrency without coloursThere is no async keyword. Any function can suspend, and callers don’t have to know. spawn starts a task, await waits for it, and no task outlives its parent.
  7. 07 Tools and agentsA tool fn is a function the compiler also describes to a model. An agent is called like a function.
  8. 08 Guarded tools and teamsPut a human in the loop with one word. Compose agents with the tools you already know: sub-agents, spawn and |>.