Louise
A statically typed language built on algebraic effects, with actors, reference counting instead of a garbage collector, and a compiler that emits C.
import std/io
import std/list
/// Search as an effect: `choose` returns once per candidate.
effect search
{
multi ctl choose :: from: Int to: Int -> Int
final ctl fail :: -> Never
}
/// Every answer the search reaches.
fn every :: action: fn() -> a / <search | e> -> List<a> / <e>
{
handle
{
[action ()]
}
with
{ choose from to -> list.range from to |> list.flat_map resume, fail -> [] }
}
/// Right triangles with integer sides up to `n`, written as if there
/// were only one.
fn triangles :: n: Int -> List<(Int, Int, Int)>
{
use <- every
let a = choose 1 n
let b = choose a n
let c = choose b n
if a * a + b * b != c * c
{
fail ()
}
(a, b, c)
}
pub fn main :: -> () / <io>
{
io.println "{triangles 20}"
}
triangles reads as if choose returned one number. The every handler resumes it once per candidate and collects every answer; use <- every installs it for the rest of the function.
Features
- Typed effects: functions declare what they do (
/ <io, sql>) and handlers decide what that means: exceptions, generators, search with multi-shotresume, dependency injection, test doubles. No monads. - Actors: typed processes with links, monitors and OTP-style supervisors, scheduled preemptively on every core.
- No garbage collector: Perceus reference counting frees memory as soon as it is unused and updates unshared values in place;
deferruns cleanups. - Types: inference, traits with
@deriveand user-defined derives, associated and higher-kinded types, GADTs, opaque types, exhaustive pattern matching. - Ergonomics: functions are curried and called without parentheses (
f x y), with~labels where a definition declares them; pipes with placeholders (x |> f a _), string interpolation, earlyreturn,ResultandOptionchained withuse. - For the web: type-checked HTML literals and
pug/htmltemplates, an HTTP server with streaming and server-sent events, a TLS client, and packages for Postgres, argon2, UUIDs and more. - Native code: compiled through C, with list pipelines fused and
Int/Floatarithmetic unboxed. Small benchmarks run in the range of GHC and Go, and a release hello world is a 387 KB static executable (performance). - C interop: call C and Rust libraries, declared in
louise.toml, with bindings generated from headers. - Tooling: dependencies from paths or git with a lockfile, a formatter, a test runner, a language server (VS Code), a tree-sitter grammar (Neovim, Helix), and
louise self update.
Louise is pre-alpha: the language and its standard library still change.
Getting started
Prebuilt (x86-64 Linux): installs the latest release into ~/.local/bin, then louise self update keeps it current.
curl -fsSL https://toboggan.cloud/louise-lang/louise/raw/main/scripts/install.sh | sh
From source: Rust (pinned in rust-toolchain.toml) and, for native builds, clang 13+ or GCC 15+.
cargo build --release -p louise -p louise_rt
alias louise=$PWD/target/release/louise
Then:
louise run hello.lse # run a program
louise build # compile the package to build/<name>
louise test # run its @test functions (--watch: again on every change)
louise fmt # format it
Documentation
- A tour of Louise;
examples/http_demo, a supervised web server with logins;examples/cluster, two nodes of a cluster - Language reference, grammar and diagnostics
- Performance: benchmarks against Rust, Go, GHC, Java, Node and Python
- Design decisions and the runtime ABI
- Contributing: commands, layout, and how decisions are recorded
Louise was named tilcayo until v1 (ADR 0021).