pub enum ParamKind {
Explicit,
Implicit,
StrictImplicit,
Instance,
}Expand description
How a function parameter is supplied during elaboration.
Variants§
Explicit
The caller provides the argument.
Implicit
Inferred by unification (a fresh metavariable is inserted).
StrictImplicit
Lean’s ⦃x : T⦄ — inferred like ParamKind::Implicit, but inserted ONLY when a later
EXPLICIT argument is actually supplied.
The fourth inhabitant of Lean’s BinderInfo, and the distinction is observable in one
direction only: fully applied, a strict implicit and an eager one build the same term.
Unapplied they do not. nilOf ⦃α⦄ : List α written on its own is still the polymorphic
FUNCTION awaiting its type; inserting the metavariable there emits nilOf ?0, which
nothing in the application can solve and which the kernel then reports as an unbound
variable far from where it was made. Under-inserting leaves a term that is still correct;
over-inserting manufactures one that is not.
Instance
A typeclass instance, resolved from the Context’s instance database — but only
AFTER the explicit arguments have been processed, so any metavariable in the class
type (e.g. the A in Inhabited A) is solved first.
Implementations§
Source§impl ParamKind
impl ParamKind
Sourcepub fn lean_binder_info(self) -> &'static str
pub fn lean_binder_info(self) -> &'static str
The name of Lean’s BinderInfo constructor for this kind — one each, a bijection.
Sourcepub fn from_lean_binder_info(name: &str) -> Option<ParamKind>
pub fn from_lean_binder_info(name: &str) -> Option<ParamKind>
The kind a Lean BinderInfo constructor names, or None for a name Lean does not have.