Introduction
Welcome to the Kira programming language.
Kira is a functional programming language with explicit types, explicit effects, and no surprises. It's designed for clarity and predictability, making it ideal for AI code generation and teams that value readable code.
Core Concepts
1. Explicit Types
Every variable, parameter, and return type must be annotated:
let x: i32 = 42
fn add(a: i32, b: i32) -> i32 { return a + b }2. Explicit Effects
Side effects are tracked in function signatures:
// Pure function - no side effects
fn double(n: i32) -> i32 { return n * 2 }
// Effect function - can perform I/O
effect fn greet(name: string) -> void {
std.io.println("Hello, " + name)
}3. Pattern Matching
Work with data safely using exhaustive pattern matching:
match result {
Ok(value) => { std.io.println("Success: " + to_string(value)) }
Err(e) => { std.io.println("Error: " + e) }
}4. Algebraic Data Types
Define your own types with sum (enum) and product (record) types:
type Shape =
| Circle(f64)
| Rectangle(f64, f64)
type Point = { x: f64, y: f64 }Standard Library Modules
| Module | Description |
|---|---|
std.io | Console I/O (print, read) |
std.fs | File system operations |
std.list | List operations (map, filter, fold) |
std.option | Optional value operations |
std.result | Error handling operations |
std.string | String manipulation |
std.builder | Efficient string building |
std.map | Hash map (dictionary) |
std.char | Character operations |
std.math | Mathematical operations |
std.time | Time and timing |
std.assert | Assertions for testing |
Learning Path
- Start here: Read the Tutorial from beginning to end
- Practice: Try the example programs
- Reference: Use the Standard Library docs to explore available functions
- Deep dive: Consult the Language Guide for syntax details
Kira: Pure clarity for functional programming.