Side Effects Can't Hide

See what your code does. Test without mocks. Ship with confidence.

Try Now Install Take the Tour
fn processOrder(order: Order): Receipt with {Database, Email} = {
    let saved = Database.save(order)
    Email.send(order.customer, "Order confirmed!")
    Receipt(saved.id)
}

// The signature tells you EVERYTHING this function does
MIT Licensed 372+ Tests Native Performance

The Problem with Side Effects

In most languages, functions can do anything. You can't tell from the signature.

Other Languages

fetchUser(id: Int): User

// Does this call the network?
// Touch the database?
// Write to a file?
// Who knows!

Lux

fn fetchUser(id: Int): User
    with {Http, Database}

// You KNOW this touches
// network and database

The Lux Solution

Three pillars that make functional programming practical.

Effects You Can See

Every function declares its effects in the type signature. No hidden surprises. Refactor with confidence.

fn sendNotification(
    user: User,
    msg: String
): Unit with {Email, Log} = {
    Log.info("Sending to " + user.email)
    Email.send(user.email, msg)
}

Testing Without Mocks

Swap effect handlers at runtime. Test database code without a database. Test HTTP code without network.

// Production
run app() with {
    Database = postgres,
    Email = smtp
}

// Test - same code!
run app() with {
    Database = inMemory,
    Email = collect
}

Native Performance

Compiles to C via gcc/clang. Reference counting with FBIP optimization. Matches Rust and C speed.

Benchmark      Lux     Rust    Go
───────────────────────────────────
fibonacci(40)  0.015s  0.018s  0.041s
ackermann      0.020s  0.029s  0.107s
primes 1M      0.012s  0.014s  0.038s
quicksort 1M   0.089s  0.072s  0.124s

Try It Now

Edit the code and click Run. No installation required.

Output
// Click "Run" to execute
Lux v0.1.0

Get Started

One command to try Lux. Two to build from source.

With Nix (Recommended)

nix run git+https://git.qrty.ink/blu/lux

One command. Zero dependencies. Works on Linux and macOS.

From Source

git clone https://git.qrty.ink/blu/lux
cd lux && cargo build --release

Then