pub struct Instance {
pub class: QualName,
pub head: Type,
pub head_name: HeadName,
pub context: Vec<Predicate>,
pub members: Vec<Declaration>,
pub unchecked: Vec<Unchecked>,
pub rejected: bool,
pub span: NodeSpan,
}Expand description
One instance declaration of a module: which class, which type, what it needs of that
type’s arguments, and a checked body for each member.
A derived instance is one of these like any other. The bindings it was checked with are the ones its class’s derivation stands for, generated by canonicalization, and nothing here says they were not written.
The types here and the types inside a member’s Declaration are each their own
inference’s. The variables of head are the ones the instance’s
context is over; a member’s declaration is solved on its own, so
its type and its own context name variables of that solve, and the two are related by
the member’s signature at the head and not by sharing variable numbers.
Fields§
§class: QualNameThe class, named by the package and module that declared it.
head: TypeThe type the instance is for: a declared type applied to a distinct variable per
parameter, a tuple of distinct variables, or ()
(the head rule).
head_name: HeadNameThe name at the front of head, which with the class identifies the
instance: two instances of one class whose heads share it are one instance declared
twice, and a use of a member is answered by the one that matches.
context: Vec<Predicate>What the instance needs of the head’s variables, in the order written.
members: Vec<Declaration>The bindings that checked, one for each member of the class, sorted by name. Each
is a Declaration named for the member, whose context
is the instance’s own.
unchecked: Vec<Unchecked>The bindings that did not check, accounted for as Module::unchecked accounts
for a value, sorted by name.
rejected: boolWhether the instance’s own check failed: a superclass the instance cannot prove at its head. An error stands behind it, and a backend refuses it.
span: NodeSpanWhere the head line was written, instance through where.