gleamunison/loader

Types

pub opaque type Loader
pub type LoaderError {
  CompileFailed(identity.DefinitionRef, message: String)
  LoadFailed(identity.DefinitionRef, message: String)
}

Constructors

Values

pub fn ensure_loaded(
  ld: Loader,
  ref: identity.DefinitionRef,
  def: ast.Definition,
) -> Result(Loader, #(Loader, LoaderError))
pub fn exports(
  ref: identity.DefinitionRef,
) -> Result(List(#(String, Int)), String)

Export table of the ref’s loaded module, sorted. Locks the compiler’s export contract (every definition exports '$eval'/0, plus ability op stubs) and backs introspection such as run --json on a function.

pub fn is_loaded(ld: Loader, ref: identity.DefinitionRef) -> Bool
pub fn module_available(ref: identity.DefinitionRef) -> Bool

True when the ref’s compiled module is already present in this runtime, so loading it is a no-op and the store need not hold it. Genesis builtins ship as m_*.erl sources compiled into the build and the escript archive.

pub fn new_loader() -> Loader
pub fn new_loader_with_limit(limit: Int) -> Loader
✨ Search Document