Hole goals¶
The goal of each typed hole of a checked module, read off the kernel checker, and the check a filling must pass. See Typed holes.
goals
¶
The goals of a module's typed holes: what each must be and what it can see.
A hole is well typed at its type, so checking proceeds around it. What
the author needs back is the hole's goal: the type a filling must have,
and the bindings in scope where the hole stands, which are what a filling
may mention. hole_goals reads both off
the kernel checker itself (through HOLE_OBSERVER),
so a goal reports exactly the context the checker checks the hole in.
check_filling checks a proposed
filling against a goal by the same rules.
HoleGoal
didactic-model
¶
HoleGoal(*, name: str, type: TypeExpr = field(opaque=True, extras=OPAQUE_BY_VALUE), bindings: tuple[Local, ...] = field(opaque=True, extras=OPAQUE_BY_VALUE), declaration: str, origin: SourceOrigin = field(opaque=True, extras=OPAQUE_BY_VALUE), context: CheckContext = field(opaque=True, extras=OPAQUE_BY_VALUE))
Bases: ValueModel
What a typed hole must be, and what is in scope where it stands.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The hole's name, without the sigil.
TYPE:
|
type
|
The goal: the type every filling must have.
TYPE:
|
bindings
|
The value bindings in scope at the hole, outermost first, each with its type; a filling may mention any of them.
TYPE:
|
declaration
|
The computation or handler whose body holds the hole.
TYPE:
|
origin
|
Where the hole was written.
TYPE:
|
context
|
The checker's whole context at the hole, including the equations enclosing case branches establish, against which a filling is checked.
TYPE:
|
render
¶
Render the goal as a check report shows it.
| RETURNS | DESCRIPTION |
|---|---|
str
|
|
Source code in src/quivers/qiec/goals.py
hole_goals
¶
hole_goals(module: QiecModule) -> tuple[HoleGoal, ...]
Every value hole of a module with its goal type and bindings.
The module's declarations are resolved and every handler clause and computation body is checked once with an observer installed; each hole the checker meets is reported with the context it was checked in.
| PARAMETER | DESCRIPTION |
|---|---|
module
|
The checked module.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
tuple[HoleGoal, ...]
|
One goal per hole occurrence, in the order the checker meets them (handlers first, then computations in declaration order). |
| RAISES | DESCRIPTION |
|---|---|
KernelError
|
If the module does not check. |
Source code in src/quivers/qiec/goals.py
type_hole_names
¶
type_hole_names(module: QiecModule) -> tuple[str, ...]
The names of a module's type holes, without the sigil.
| PARAMETER | DESCRIPTION |
|---|---|
module
|
The checked module.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
tuple[str, ...]
|
One name per type hole, in declaration order. |
Source code in src/quivers/qiec/goals.py
check_filling
¶
check_filling(goal: HoleGoal, filling: Value, registry: KernelRegistry) -> None
Check a proposed filling against a hole's goal.
| PARAMETER | DESCRIPTION |
|---|---|
goal
|
The hole's goal.
TYPE:
|
filling
|
The value proposed for it; it may mention the goal's bindings.
TYPE:
|
registry
|
The module's resolved declarations.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
KernelError
|
With code |