# `Predicator.Cast`
[🔗](https://github.com/riddler/predicator-ex/blob/v9.4.1/lib/predicator/cast.ex#L1)

The `::` cast conversion matrix.

Implements every legal source-to-target conversion for the seven scalar
ISA type names. The normative matrix is
[`docs/isa.md`](../../docs/isa.md) section 5, under `cast`; ADR-0011
records why casting is an opcode rather than a lowering to `call`.

`cast/2` is total over values and never raises or returns an error tuple:
`:undefined` propagates, and a conversion that cannot produce a value of the
target type also yields `:undefined`. This module is not part of the
predicate surface - the only way an author reaches it is through `::` - it
is public for the same reason `Predicator.Duration` is: a value-layer
helper worth documenting and testing on its own.

# `cast`

```elixir
@spec cast(term(), binary()) :: term()
```

Converts `value` to the named type, or `:undefined` when it cannot.

`type_name` must be one of `type_names/0`; passing anything else is a
`FunctionClauseError` at this module's boundary, since the caller (the
evaluator, guarded on the same list) never passes one.

# `type_names`

```elixir
@spec type_names() :: [binary()]
```

The seven scalar ISA type names casts accept (docs/isa.md section 3).

---

*Consult [api-reference.md](api-reference.md) for complete listing*
