Kalandra

Learn

Local modules

A functional language for parallel and distributed programming. The next chapter of Clio.

Use export to expose a declaration, and from with import to bring named exports into another file. The ./ prefix resolves relative to the importing source file.

Split a program

Save these files in the same directory. main.kalandra imports double from math.kalandra. The project compiler follows the import, shares its exported type information, and emits both modules.

main.kalandra

kalandra
from "./math" import double

export fn main: double 21

math.kalandra

kalandra
export fn double n: n * 2

Expected result:

text
42

This example needs multiple files. Save both files in the same directory and run main.kalandra with the CLI; the playground currently accepts one file.

bash
bun run cli run /path/to/main.kalandra --strict

Build without running

The build command writes native JavaScript ESM and source maps without executing the source:

bash
bun run cli build /path/to/main.kalandra -o dist/my-program --strict

Build and run use the nearest enclosing kalandra.toml and its build.source when present. Standalone files use their containing directory as the source root. Module cycles remain unsupported.

Installed Kalandra packages under .kalandra/modules are supported. The install command explicitly installs Git dependencies from kalandra.toml and records commit locks. JavaScript imports use explicit esm: or cjs: prefixes; packages can supply Kalandra type declarations. Importing a package is separate from installing it.

These package features are available locally. The single-file playground intentionally does not fetch modules or packages.

Next: parallel execution