---
title: "11.8 Recap and reference"
url: https://una-lang.org/en/learn/packages/recap-and-reference/
release: v0.4.0
edition: "0.2"
---

# 11.8 Recap and reference

## 11.8.1 For agents

:::agents
A diagnostic about an import carries the place of the declaration as a related span, and its repair. For [Private stays private](https://una-lang.org/en/learn/packages/pub-and-import/#private-stays-private):

```json include="steps/09-private/expected/commands/json.txt#L2"
{"schema":"una.diagnostics/1","diagnostics":[{"schema":"una.diagnostic/1","code":"U1004","severity":"error","domain":"names","message":"function `digits` is private to module `store.money`","primary":{"file":"src/store/app.una","start":{"line":4,"col":21},"end":{"line":4,"col":27}},"related":[{"file":"src/store/money.una","start":{"line":10,"col":1},"end":{"line":10,"col":7},"message":"declared here without `pub`"}],"repairs":[{"rank":1,"escape_cost":0,"widens":{"kind":"visibility","cost":"every module may then call it: check that it belongs to the module's interface"},"description":"declare `digits` with `pub`","edit":{"file":"src/store/money.una","start":{"line":10,"col":1},"end":{"line":10,"col":1},"replacement":"pub "}}],"explain":"una explain U1004"}],"fixable":0}
```

The repair has `escape_cost` 0, but `widens` names the visibility it would open, so `una fix` skips it. It gives the reason `widens authority` for every repair that widens what code may reach, visibility included:

```text include="steps/09-private/expected/commands/fix.txt"
$ una fix --dry-run .
skipped src/store/money.una:10:1 U1004 declare `digits` with `pub`: widens authority
```

The compact rule: *one module per file, named by its path; take each declaration you use with a named import; make a declaration `pub` only on purpose, with its whole header written; keep the imports free of cycles and sorted.*
:::

## 11.8.2 Recap

:::recap
- One file is one module, and its header names its path under `src/`: `src/store/money.una` is `module store.money`.
- Declarations are private by default. Mark `pub` only what other modules need, with a doc comment and its whole header written.
- Import each declaration you use by name. A sum kind brings its variants, and a record its constructor and fields.
- Keep the imports a graph with no cycle, and let `una fmt` keep them sorted.
- `una.toml` has a fixed set of tables and keys; an unknown one is U7002. A package imports only its own modules, `std.host` and `std.testing`.
- `verification.lock` pins the solver, so every machine gets the same result: copy it, do not edit it.
- Keep each module's examples in the module; `una test .` runs those of every module, after one check of the whole package.
:::

## 11.8.3 Reference

:::reference
- Construct and configuration pages: [modules and imports](https://una-lang.org/en/docs/language/modules/), [`kind`](https://una-lang.org/en/docs/language/types/kind/), [`where`](https://una-lang.org/en/docs/language/types/where/), [`example`](https://una-lang.org/en/docs/language/examples/example/), [canonical form](https://una-lang.org/en/docs/language/canonical-form/), [`una.toml`](https://una-lang.org/en/docs/configure/), [`[package] name`](https://una-lang.org/en/docs/configure/package/name/), [`[package] version`](https://una-lang.org/en/docs/configure/package/version/), [`[package] edition`](https://una-lang.org/en/docs/configure/package/edition/), [`[run] entry`](https://una-lang.org/en/docs/configure/run/entry/), [`[run] grants`](https://una-lang.org/en/docs/configure/run/grants/), [`[labels] categories`](https://una-lang.org/en/docs/configure/labels/categories/), [`[trusted] modules`](https://una-lang.org/en/docs/configure/trusted/modules/), [`[escape_budget] checked_per_module`](https://una-lang.org/en/docs/configure/escape-budget/checked-per-module/), [`verification.lock`](https://una-lang.org/en/docs/configure/verification-lock/)
- Diagnostics: [U1001](https://una-lang.org/en/docs/errors/U1001/), [U1002](https://una-lang.org/en/docs/errors/U1002/), [U1003](https://una-lang.org/en/docs/errors/U1003/), [U1004](https://una-lang.org/en/docs/errors/U1004/), [U1005](https://una-lang.org/en/docs/errors/U1005/), [U1008](https://una-lang.org/en/docs/errors/U1008/), [U1009](https://una-lang.org/en/docs/errors/U1009/), [U3012](https://una-lang.org/en/docs/errors/U3012/), [U5001](https://una-lang.org/en/docs/errors/U5001/), [U5002](https://una-lang.org/en/docs/errors/U5002/), [U5003](https://una-lang.org/en/docs/errors/U5003/), [U7001](https://una-lang.org/en/docs/errors/U7001/), [U7002](https://una-lang.org/en/docs/errors/U7002/), [U7004](https://una-lang.org/en/docs/errors/U7004/)
- Specification: [diagnostics, the command line and project files](https://una-lang.org/en/docs/spec/13-diagnostics-and-abi/), [grammar](https://una-lang.org/en/docs/spec/02-grammar/), [static semantics](https://una-lang.org/en/docs/spec/10-static-semantics/), [functions and contracts](https://una-lang.org/en/docs/spec/04-functions-and-contracts/), [canonical form](https://una-lang.org/en/docs/spec/15-canonical-form/), [verification](https://una-lang.org/en/docs/spec/12-verification/)
:::
