Skip to main content
Kira

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

ModuleDescription
std.ioConsole I/O (print, read)
std.fsFile system operations
std.listList operations (map, filter, fold)
std.optionOptional value operations
std.resultError handling operations
std.stringString manipulation
std.builderEfficient string building
std.mapHash map (dictionary)
std.charCharacter operations
std.mathMathematical operations
std.timeTime and timing
std.assertAssertions for testing

Learning Path

  1. Start here: Read the Tutorial from beginning to end
  2. Practice: Try the example programs
  3. Reference: Use the Standard Library docs to explore available functions
  4. Deep dive: Consult the Language Guide for syntax details

Kira: Pure clarity for functional programming.