Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

The Ore Programming Language

Ore is a statically-typed, compiled programming language with indentation-based syntax and algebraic effects.

Design Principles

  • Immutable by default. Bindings are immutable. Rebinding with = creates a new shadow, not a mutation.
  • Public by default. Items are public unless marked pvt.
  • Effects are explicit. Side effects are tracked in function signatures with !(IO + State).
  • No null. Use Option<T> for optional values and Result<T, E> for fallible operations.
  • Pattern-driven. Destructuring and pattern matching are deeply integrated — in let, match, when, and multi-clause functions.
  • Functional loops. loop/recur with accumulators instead of mutable loop variables.
  • Algebraic effects for resource management. handler/with replace both exceptions and RAII/Drop.

Syntax Overview

Ore uses indentation to delimit blocks. A colon : at the end of a line introduces an indented block:

fn greet(name: String):
  let msg = "Hello, " + name
  print(msg)

Braces { } are used for struct/enum definitions and struct literals, not for blocks.

A Quick Example

enum Shape {
  Circle(f64),
  Rectangle(f64, f64),
}

fn area(s: Shape) -> f64:
  match s:
    Circle(r): 3.14159 * r ** 2
    Rectangle(w, h): w * h

fn main() !(IO):
  let shapes = [Circle(5.0), Rectangle(3.0, 4.0)]
  shapes.for_each(|s| print(area(s).show()))