Tin

A tour of Tin

Eight short chapters for people who already program. Every code block is a real file from examples/, and every output is what the test suite checks.

Coming from Python or TypeScript? Read the side-by-side. Want it slowly, with tasks? Learn Tin.

  1. 1Hello, TinA program is a file with a main. Strings interpolate, and everything is an expression.
  2. 2Structs 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. 3No null, no exceptionsA value that may be missing is an Option. An operation that may fail returns a Result. ? passes the failure up.
  4. 4Functions, pipelines and closuresx |> f(y) means f(x, y), and so does x.f(y). Use whichever reads better.
  5. 5GenericsGeneric code is specialised at compile time. Stack<int> and Stack<string> become separate WebAssembly functions.
  6. 6Concurrency 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. 7Tools and agentsA tool fn is a function the compiler also describes to a model. An agent is called like a function.
  8. 8Guarded tools and teamsPut a human in the loop with one word. Compose agents with the tools you already know: sub-agents, spawn and |>.