The Saga Guide
Learn Saga from the ground up, from Hello World to effects, handlers, and concurrency.
Language Tour
A quick overview of everything Saga offers, in one page.
02Installation
Install Erlang, the Saga compiler, and set up your editor.
03Getting Started
Your first Saga program, basic commands, and a quick taste of the language.
04Basics
Bindings, primitive types, operators, blocks, strings, and pipes.
05Functions
Definitions, annotations, pub/private, lambdas, currying, and composition.
06Types
ADTs, records, tuples, type parameters, opaque types, and dictionaries.
07Pattern Matching
Case expressions, guards, destructuring, list/record/string patterns, and exhaustiveness.
08Control Flow
do...else for sequential pattern binding, and list comprehensions.
09Traits
Type-driven dispatch with Show, Eq, Ord. where clauses, supertraits, and deriving.
10Effects & Handlers
Declaring effects, performing with !, writing handlers, resume, and abort.
11Error Handling
The Fail effect, to_result, Result vs Fail philosophy, panic, and catch_panic.
12Handler Patterns
Named, inline, let-bound, and factory handlers. Stacking, ordering, and the return clause.
13Advanced Effects
Row polymorphism, effect signatures on higher-order functions, subtyping, and multishot continuations.
14Testing
Effect-based testing with describe, test, handler swapping, and CI integration.
15Project & Modules
Project layout, project.toml configuration, module declarations, imports, pub visibility, and qualified access.
16Ecosystem
Hex, git, and path dependencies. saga install, the lockfile, transitive deps, NIF compilation with rebar3, and the dep cache.
17Concurrency & Actors
The Actor effect: spawn, send, receive. Isolation and message passing on the BEAM.
18Supervision
Supervision as a handler pattern. Restart strategies, backoff, and let-it-crash.
19BitStrings
Binary construction, pattern matching, segment specifiers, and Std.BitString.
20Refs
Atomic references for controlled mutable state. When to use refs vs recursion.
21Interop
Calling Erlang, Hex dependencies, git deps, and project.toml configuration.
22Generic Deriving
Make your own traits derivable. The Generic representation, building-block instances, and the rules a derivable trait must follow.