Modules
Kura source files use the .kui extension. A file can share code with other files through
pub and use.
Declarations are private to their file unless marked pub:
pub type Health = { current: Int, max: Int }
pub fn percent(h: Health): Int => h.current * 100 / h.max
fn helper() => ... // privateuse imports another file by its path, including the explicit .kui extension. Imports
are qualified: you refer to the contents through the module’s name.
use "health.kui" // refer to it as healthuse "health.kui" as hp // refer to it as hp
fn bar(h: hp.Health): Int => hp.percent(h)The default name is the file’s base name. Unqualified imports are not supported.
The standard library
Section titled “The standard library”The standard library root comes from an environment variable and is imported with a
std/ prefix:
use "std/color.kui" as colorThe v1 standard library is intentionally minimal: just enough for runtime types with memory management, loading UIs, and rendering UIs.
C headers
Section titled “C headers”use also imports C headers. A .h extension says the file is C. See
C Interop.
One UI per file
Section titled “One UI per file”By convention, a .kui file describes one UI or one UI element. A game HUD might be split
into a health bar, a map and an inventory bar, each its own file with its own view.