eval::session
eval/src/session.mo
pub struct EvalSession {
source : String, // committed declarations
cache : ModuleInfoCache, // warm parse cache across inputs
file_path : String, // "repl.mo" (cwd-relative)
module_name : String, // module_name_from_path file_path
affine_warn : Bool, // AffineMode is not Copy
decl_count : I64, // declarations in `source`
next_expr : I64, // the next synthetic expression name
}pub type EvalInput {
eval_input_meta (command : String),
eval_input_decls (source : String) (decls : List Decl) (decl_count : I64),
eval_input_expr (source : String) (decls : List Decl) (root : String),
eval_input_type (source : String) (decls : List Decl) (root : String)
(display : String),
eval_input_continue,
eval_input_blank,
eval_input_error (message : String),
}pub type EvalResponse {
eval_response_blank,
eval_response_ok (warnings : List String),
eval_response_value (text : String) (typ : String) (warnings : List String),
eval_response_meta (text : String),
eval_response_error (message : String),
eval_response_quit,
}pub def Eval.new_session (file_path : String) : IO EvalSessionpub def Eval.classify (s : EvalSession) (text : String) : Pair EvalSession EvalInputpub def Eval.step (s : EvalSession) (input : EvalInput)
: IO (Pair EvalSession EvalResponse)