示例
CI 用登记参数运行每个入口,并逐字节核对 stdout 与 stderr;多模块项目给目录。
入门
fib— Fibonacci two ways: naive recursion, and a tail call that becomes a loop.fizzbuzz— FizzBuzz: match guards, string interpolation and a `for` over a range.lambdas— Function values: lambdas, captures, higher-order functions, effect variables.
数据建模
generics— Generics: type parameters, Option and Result, and the list builtins.records— Records: literals, field shorthand, functional update, and record patterns.shapes— Sum types and pattern matching: a Shape ADT, guards, pipes and test blocks.
文本与字符
chars— Characters and code points: making a slug, and the two renderings of a Char.
trait
eqhash— Eq and Hash: the prelude traits behind `==` and hashing.traits— Traits: a default method, impls for a record and for Int, bounded generics.
效果
handlers— Effect handlers: an interpreter that carries no environment parameter.tracking— Effect tracking: `!io` in a signature, and the compiler holding you to it.
失败处理
barriers— Failure in three tiers: `Result` with `?`, `catch_fault`, and `bracket`.
Java 互操作
interop— Java interop, worked: the JDK's own static factories, laying out a build.
完整程序
calc— A four-function calculator: a lexer, a precedence-climbing parser, an eval.hello_mod— A multi-module project: one directory, three modules, no manifest.json— A pure-Dawn JSON validator, run against JSONTestSuite's 318 fixtures.tea_dom_counter— The whole io surface of the demo: one call.tea_dom_flags— The whole io surface of the demo: one call, exactly as tea_dom_counter's, with `serve_with_flags` in place of `serve`.tea_dom_search— The whole io surface of the panel: one call, exactly as tea_dom_flags's.tea_dom_todo— The whole io surface of the demo: one call, exactly as tea_dom_counter's.tea_dom_todo_keyed— The todo list with its rows keyed by id, which is the demo dawn-lang.dawnop.com mounts; its io surface is one call, exactly as tea_dom_counter's.tea_todo— An interactive todo list built on packages/tea-core and packages/tea-term, the Elm architecture v1: the model, messages, update and view live in todo.dawn as pure functions. Since renderer knife 3 the io loop lives in the library too (tea_term/runtime.run, incremental repaint included), so this file is down to naming the app's pure hooks: which tree to paint, how a line becomes a message, which ticks the model wants (none), and when to stop.