# Examples

The docs are code-heavy. Every example is concise: it shows the problem it solves and nothing else.

## Folds

Lines that are not the point (imports, setup, types the reader has met) are folded, not deleted. The reader sees the focus and can expand the rest. The full example, folds included, is what the examples check compiles.

## The examples check

Every code block is checked in CI by the project's own compiler or type checker, against the current source. A rename in the code then fails the docs build, not the reader.

A code block meets the check in one of two ways:

- **Checked in place**: the docs tool extracts the block and checks it.
- **Included from a file**: the block is a region of a real file in the repo that is already checked or tested.

Checking is the requirement; running is a bonus. An example that also runs, doctest-style, is welcome.

The only blocks the check skips are blocks explicitly marked as not code: shell commands, program output, pseudo-code. The mark is explicit on each block.

---

### MIT license

```text
MIT License

Copyright (c) 2026 Matt Pocock

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```