# Signals

A signal is a pattern `jadpo suggest` looks for. Signals are data on each
standard type's contract entry ([Standard
library](19-standard-library.md)), never code of their own, so a type
adds signals by adding data. Each kind of signal has one engine that reads
every entry.

| Signal | Data on the entry | Fires on | Example |
|---|---|---|---|
| `shape` | The fields `type.standard_exists` matches ([Standard library](standard-library.md)) | A type or entity holding all of a shape's fields among others of its own; exactly the shape is `type.standard_exists`, a `jadpo check` error | `latitude` and `longitude` in `Shop` → `Point` |
| `conversion` | Constants code multiplies or divides by, and the words of names a value of the type goes by; a quantity's factors between its units and its units' names and codes | A multiplication or division by one of the constants whose other side has a name with one of the words, unless it already is the type | `total_price * 100` → `Money` |
| `name` | The same words, and the built-in types a hinted name is built on | A field, parameter or type built on one of those types whose name has one of the words | `timeout_ms: Int` → `Duration` |
| `format` | Text that formats a value by hand: a currency symbol, a unit's symbol | A text literal holding it, joined with `+` to a value | `"£" + text.from(pence)` → `Money` |
| `validation` | Texts the type's validation accepts and texts it refuses | A regular expression, in `matches` or a `pattern:` rule, that accepts every one and refuses every one | `pattern: "[^@]+@[^@]+\\.[a-z]+"` → `Email` |
| `loop` | A table beside the operation table, since operations have no contract entry: the loop each operation replaces | A `for` loop whose only statement is that loop's | `total = total + item.price` → `list.sum` |
| `taught` | A snippet `jadpo suggest found` recorded, in this checkout | The same canonical form anywhere | as recorded |

The entries with signals so far:

- `Money`: × or ÷ 100 and 1000, the minor units of two- and three-place
  currencies; `price`, `pence`, `cents`, `cost`; `£`, `$`, `€`, `¥`.
- Every quantity: its units.
- `Duration`: 1000, 60, 3600, 86400; `ms`, `millis`, `seconds`,
  `minutes`, `hours`, `timeout`.
- `Instant`: 1000; `epoch`, `timestamp`, `unix`.
- `Point`: its shape.
- `Email`, `Url` and `Uuid`: their validation texts, and `email`, `url`,
  `uuid` as names on `Text`.
- The loops of `list.sum`, `list.min_by` and `list.max_by`.

`list.group_by`'s loop builds a map through a chain of calls that the
graph shows only as calls, so it has no loop signal yet. A type's
validation texts are data of their own, not its examples, so only the
types that list them fire.

A snippet gives one finding. Where signals for two types fire on one
snippet, the type whose words more of its names hold wins, then the first
in the entries' order. Where a snippet holds a smaller one that fires the
same way, only the smaller is reported. A type with
`decline type.standard_exists` gives no `shape` finding.
