Basics3
Modelling data4
genericsGenerics: type parameters, Option and Result, and the list builtins.
narrowNarrow floats: bfloat16 and binary16 as values that round the way the hardware rounds.
recordsRecords: literals, field shorthand, functional update, and record patterns.
shapesSum types and pattern matching: a Shape ADT, guards, pipes and test blocks.
Text and characters1
charsCharacters and code points: making a slug, and the two renderings of a Char.
Traits2
Effects5
cellsHandler state: a
vardeclared in the arm table, and the block below the handler reading what the arms left there.filesThe file system as a named effect: one reader, two handlers.
handlersEffect handlers: an interpreter that carries no environment parameter.
resumptionOne-shot resumption: an answer that arrives turns later, read as the value of a
let.trackingEffect tracking:
!ioin a signature, and the compiler holding you to it.
Failure1
barriersFailure in three tiers:
Resultwith?,catch_fault, andbracket.
Java interop1
interopJava interop, worked: the JDK's own static factories, laying out a build.
Whole programs9
calcA four-function calculator: a lexer, a precedence-climbing parser, an eval.
comptime_bytesA binary lookup table is a Bytes value, with no text encoding or boxed integer list in the final constant. The package CRC and SHA functions are also called unchanged at comptime. This example makes no speed claim for table lookup: choosing a runtime CRC algorithm still needs measurement.
gpu_fakeA GPU program on a machine with no GPU: ten kernels, two sides, one handler that is a table in host memory.
hello_modA multi-module project: one directory, three modules, no manifest.
jsonA pure-Dawn JSON validator, run against JSONTestSuite's 318 fixtures.
qualified_effectsQualification changes lookup, not the evidence supplied by a handler.
tea_dom_counterThe whole application: a model, three messages,
updateandview, plus the text form of the model the wire carries between turns. No io and no host;main.dawnis the one call that connects it to one.tea_dom_todo_keyedThe pure half of the demo: model, messages,
updateandview. No io, no wire format, no host, so every assertion below is==on a value.tea_todoThe pure half of the todo app: model, messages,
update,view, and the line parser. Everything here is a value-in, value-out function, which is what the test blocks below lean on -- an interaction is asserted as data, no terminal in sight. The io shell around it is main.dawn.