lang::typecheck::meta_eval

lang/src/typecheck/meta_eval.mo

Real evaluation of a meta-def (a TypeInfo -> List Decl function, e.g. std/derive.mo's derive_lens_meta) against a Value argument -- the self-hosted analogue of rust/core/src/eval/meta_compile.rs's MetaEvalContext (Rust).

Unlike the Rust reference, this needs no type-check as a prerequisite: lang/core_eval.mo (the closure-based CoreIr evaluator) and lang/lower_core_ir.mo (Term -> CoreIr lowering) already exist, are already tested end-to-end (lang/tests/core_eval_lang_tests.mo's own lower_and_run), and build straight from a raw List Decl (lower_ctx_from_decls) -- this module just drives that existing machinery directly, mirroring lower_and_run's exact shape.

Caller's responsibility, not this module's: dispatched_decls must already be a decl list where every class-method call site (==, BEq.beq, Bool.and, ...) has been resolved to a concrete, directly-callable function -- lower_core_ir.mo's free-variable resolution has no concept of typeclass dictionaries. The caller (lang/typecheck/macro_queue.mo's expand_decls_graph) is responsible for running elaborate_module_decls_best_effort + resolve_class_calls_decls (the same "prepare for real execution" pipeline codegen/test_driver.mo already runs before compiling a test driver) before ever calling meta_eval_invoke.

defshow_value_debug#
pub def show_value_debug (v : Value) : String
defshow_core_eval_error_debug#
pub def show_core_eval_error_debug (e : CoreEvalError) : String