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 andResult<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/recurwith accumulators instead of mutable loop variables. - Algebraic effects for resource management.
handler/withreplace 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()))