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

# 4.9 Recap and reference

## 4.9.1 For agents

:::agents
`una --json check .` prints each diagnostic with its `code`, `message`, `primary` span and `repairs`; `una --json test .` prints each example's outcome. U2004 and U2026 carry exact edits, which `una fix .` applies: the field's label, and the constraint `[T: Eq]`. U2007's repair names the missing variant, but the arm's value depends on intent, so add it by hand. U1001, U2001, U2009 and U2025 depend on intent. The compact rule: *a record builds with every field labeled; a sum lists its variants with `|`, and one of a single variant starts with `|`; a `when` over a sum matches every variant or ends with `else`; a public generic function writes the constraint its body needs.*
:::

## 4.9.2 Recap

:::recap
- `kind Parcel` with indented fields is a record: build it with every field labeled, and read a field with a dot.
- A record never changes: to change a field, build a new record from the old one.
- Records are nominal: two kinds with the same fields are two types. An alias, `kind Sku = Text`, is the type it names.
- `kind Zone = Local | National | Abroad` is a sum; a variant may carry fields, and a sum of one variant starts with `|`.
- `value is AtLocker` tests the variant and gives a `Bool`.
- `when` takes a sum apart: one arm per variant, each binding the fields it uses, or `else` for the rest.
- Leave out `else` where each variant needs its own answer: a new variant is then reported.
- Generic kinds and functions take type parameters, `[T]`, with the weakest constraint the body needs.
:::

## 4.9.3 Reference

:::reference
- Construct pages: [`kind`](https://una-lang.org/en/docs/language/types/kind/), [`when`](https://una-lang.org/en/docs/language/control-flow/when/), [constraints on generics](https://una-lang.org/en/docs/language/types/constraints/), [`example`](https://una-lang.org/en/docs/language/examples/example/)
- Prelude: [`Option`](https://una-lang.org/en/docs/std/)
- Commands: [`una check`](https://una-lang.org/en/docs/cli/check/), [`una test`](https://una-lang.org/en/docs/cli/test/), [`una fix`](https://una-lang.org/en/docs/cli/fix/), [`una contract`](https://una-lang.org/en/docs/cli/contract/)
- Diagnostics: [U0101](https://una-lang.org/en/docs/errors/U0101/), [U1001](https://una-lang.org/en/docs/errors/U1001/), [U1002](https://una-lang.org/en/docs/errors/U1002/), [U2001](https://una-lang.org/en/docs/errors/U2001/), [U2004](https://una-lang.org/en/docs/errors/U2004/), [U2007](https://una-lang.org/en/docs/errors/U2007/), [U2008](https://una-lang.org/en/docs/errors/U2008/), [U2009](https://una-lang.org/en/docs/errors/U2009/), [U2025](https://una-lang.org/en/docs/errors/U2025/), [U2026](https://una-lang.org/en/docs/errors/U2026/), [U2027](https://una-lang.org/en/docs/errors/U2027/), [U7001](https://una-lang.org/en/docs/errors/U7001/)
- Specification: [types](https://una-lang.org/en/docs/spec/03-types/), [grammar](https://una-lang.org/en/docs/spec/02-grammar/), [functions and contracts](https://una-lang.org/en/docs/spec/04-functions-and-contracts/), [static semantics](https://una-lang.org/en/docs/spec/10-static-semantics/), [constraints on generics](https://una-lang.org/en/docs/spec/20-constraints-on-generics/)
:::
