Skip to content

Nulang

Build fault-tolerant distributed systems with the elegance of algebraic effects and row-polymorphic types.

Why Nulang?

Nulang fuses Erlang-style fault tolerance with a modern type system: Hindley-Milner inference, Pony-inspired reference capabilities, and Koka-style row-polymorphic algebraic effects. It compiles to a register-based bytecode VM with Cranelift JIT tiering, WASM, and native AOT backends.

Distributed Actors

Location-transparent actors with BEAM/OTP primitives — spawn, link, monitor, supervise. Automatic clustering with gossip membership and CRDT state replication.

Algebraic Effects

Koka-inspired row-polymorphic effects with compile-time checking. Handle, perform, resume — algebraic effect handlers compose freely without monad transformers.

Row-Polymorphic Types

Full Hindley-Milner type inference with row polymorphism for both records and effects. Pony-inspired reference capabilities (iso, trn, ref, val, box, tag) enforced at compile time.

BEAM/OTP Primitives

Supervision trees (one_for_one, one_for_all, rest_for_one, simple_one_for_one), process groups, named registration, and exit trapping — battle-tested fault tolerance patterns.

WASM Backend

Compile to WebAssembly with full MIR→WASM translation. Run in Wasmtime with 4GiB guard pages, SIMD support, and AOT compilation for near-native performance.

AI Runtime

Built-in LLM integration with provider-agnostic API (OpenAI, Ollama). Agent pipelines, debate teams, supervisor hierarchies, and episodic/semantic/procedural memory.

Quick Example

// A simple counter actor
actor Counter {
state count: Int = 0
behavior inc() {
self.count = self.count + 1
}
behavior get(sender: Actor) {
send sender reply(self.count)
}
}
// Spawn and use it
let counter = spawn Counter {} in {
send counter inc()
send counter inc()
// counter.count is now 2
counter
}

Installation

Terminal window
# Clone and build from source
git clone https://github.com/dporkka/nulang.git
cd nulang
cargo build --release
# Start the REPL
cargo run -- --repl

Support

Nulang is open source under the Apache 2.0 license. If you find it valuable, consider supporting its development.