Skip to content

Standard library

The compiler repository ships the standard library in libs/std. It is a normal Ligare library package with compiler-intrinsic declarations in std::primitive.

Set LIGARE_STD_PATH to the directory containing src/lib.lig when using an installed or relocated compiler:

bash
export LIGARE_STD_PATH="/absolute/path/to/ligare/libs/std"

Public modules

ModuleMain contents
std::ioput_str, print_line, read_char_code, and IO combinators.
std::fmtThe Display constraint plus display and to_string.
std::stringBasic string construction, concatenation, and repetition.
std::data::boolBoolean operations and selection.
std::data::natThe Nat struct and arithmetic/order helpers.
std::data::orderThe Ordering enum.
std::data::productGeneric Pair and Either values.
std::mem::listGeneric lists and traversal helpers.
std::mem::vecLength-indexed vectors.
std::optionGeneric optional values and combinators.
std::resultGeneric success/error values and combinators.
std::opsOperator and conversion constraints.
std::preludeCommonly used standard-library exports.
std::metaAttributes and compile-time syntax support.

Primitive declarations

std::primitive declares compiler-provided constraints and operations such as int, bool, str, IO, ptr, arithmetic, comparisons, and string concatenation. These declarations are visible in the standard library so the compiler's intrinsic surface has a source-level home.

Example

ligare
use std::data::nat::Nat
use std::io::print_line

pub def main : IO () :=
  do
    let value : Nat := succ Nat::zero
    print_line value

The library is still evolving. The compiler source and libs/std/src are the authoritative references for available names and signatures.