Modules and imports
Modules let a package split definitions across source files. Declare a child module in the parent:
mod math
use math::add
pub def main : IO () :=
let _ = add 1 2 in ()The declaration above loads src/math.lig when it is in the package entry module's directory. src/math.lig can export:
pub def add (left right : int) : int := left + rightOnly public definitions and modules are visible outside their defining module. Private helpers can be used freely inside the module that defines them.
Nested modules
Directories use a mod.lig file to declare child modules:
src/
├── main.lig
└── data/
├── mod.lig
└── nat.ligsrc/data/mod.lig can contain pub mod nat, and the entry file can import data::nat::value.
Standard library and dependencies
The standard library is addressed as the std package:
use std::data::nat::Nat
use std::io::print_lineOther packages use the same qualified path form after being declared in ligare.toml. Import trees support aliases and grouped names:
use math::add as plus
use data::nat::{Nat, zero}The compiler and ligls use the same module graph and visibility checks, so a name accepted by the editor should follow the same package boundaries as a compiler invocation.