Skip to content
BANG

Tour

A guided walk through bang, one concept per page. Every code sample below is a real, gated example from the repo's examples/ corpus — the shown output is read from its expected.txt at build time, so it cannot drift from what bang run actually produces.

This is the v0, no-exec tour: read the code, read the expected output, then run it yourself locally (each lesson has a copy-paste command). An in-browser "edit and run" door is future work, not v0.

  1. Values are thunks; $ forces — description-vs-value, $ (ADR-0007)
  2. Functions & recursion — a generic let rec over your own data, no trait bound
  3. Your own datadata, constructors, pattern match, deriving
  4. Pattern match: wildcards & mutual recursion — the _ wildcard arm, let rec … and … mutual recursion
  5. State as a library — State is a handler, not a keyword
  6. Handling an effectwith, catching raise
  7. Declare your own effecteffect decl, perform, handle end-to-end
  8. Swap the handler, keep the program — the same program under two different handlers
  9. Identity dispatch (the lexical cap) — why nesting the same effect twice does NOT pick the nearest handler
  10. Generation as an effect — seeded, replayable nondeterminism — the DST warm-up