Short, focused AffineScript programs for building muscle memory before reading the full Frontier Guide.
Each script is self-contained and has inline exercises to try.
# Parse only (syntax check):
affinescript parse 01_basics.affine
# Type check:
affinescript check 02_ownership.affine
# Evaluate (for scripts that produce output):
affinescript eval 01_basics.affine| Script | Covers |
|---|---|
Let bindings, literals, functions, pattern matching |
|
|
|
Effect declarations, effect composition, effect polymorphism |
|
Row-polymorphic records, row type aliases, spread syntax |
When using an AI agent to learn AffineScript interactively, point the agent at these files in order. Each file ends with numbered exercises — a suitable prompt is:
"Complete exercise 1 in this warmup. If the compiler accepts it, move on. If it rejects it, read the error and try to understand what rule was violated before looking it up."
The exercises are deliberately constraint-based: success is learning to work within the type system, not producing output as quickly as possible.