gleamunison/repl_eval
Values
pub fn bootstrap_defs(
defs: List(#(String, elab_types.SurfaceDef)),
cache: types.TypeCache,
) -> #(types.TypeCache, List(#(String, elab_types.SurfaceDef)))
pub fn compile_def_module(
term: elab_types.SurfaceTerm,
name: String,
cache: types.TypeCache,
prev_defs: List(#(String, elab_types.SurfaceDef)),
) -> Result(#(String, ast.Type, types.TypeCache), String)
Elaborate + compile + load a term definition, returning the loaded module name, its type, and the advanced cache. Split from do_eval so callers can choose how to run the module: plainly (REPL), or wrapped in handler frames (replay, capabilities, transcripts).
pub fn deserialize_term(bytes: BitArray) -> a
pub fn do_eval(
term: elab_types.SurfaceTerm,
name: String,
cache: types.TypeCache,
prev_defs: List(#(String, elab_types.SurfaceDef)),
) -> Result(#(String, ast.Type, types.TypeCache), String)
pub fn eval_module(mod_name: String) -> Result(String, String)
pub fn format_elab_error(
err: elab_types.ElaborateError,
prev_defs: List(#(String, elab_types.SurfaceDef)),
) -> String
Render an elaboration error for humans. Public: the LSP server renders the same messages, but needs the span separately (see span_of_error).
pub fn handle_define(
name: String,
val: elab_types.SurfaceTerm,
cache: types.TypeCache,
prev_defs: List(#(String, elab_types.SurfaceDef)),
) -> Result(
#(types.TypeCache, List(#(String, elab_types.SurfaceDef))),
String,
)
pub fn load_binary(
mod_name: String,
beam: BitArray,
) -> Result(Nil, String)
pub fn ref_for_name(name: String) -> identity.DefinitionRef
pub fn seed_builtin_term_types(
cache: types.TypeCache,
) -> types.TypeCache
Bootstrap terms (add, sub, mul, …) dual-register as Math ability ops whose signatures carry the real types. Elaborating a term as SRef to a genesis ref would otherwise cache TypeVar(-1), leaving the checker blind to builtin misuse. Seed the genesis refs with the declared op types so every RefTo resolves honestly. This is a pure data move: the op table is the source of truth, the cache just stops dropping it.
pub fn serialize_term(term: a) -> BitArray
pub fn string_to_binary(s: String) -> BitArray
pub fn unload_binary(mod_name: String) -> Result(Nil, String)