March is a statically typed functional language. It has ML-style algebraic data types and pattern matching, Erlang-style actors and supervision, and compiles to native code with LLVM. Memory is reference counted (Perceus), so there's no garbage collector.
mod Main do
needs IO.Console
type Shape = Circle(Float) | Rect(Float, Float)
fn area(s : Shape) : Float do
match s do
Circle(r) -> 3.14159 *. r *. r
Rect(w, h) -> w *. h
end
end
actor Ledger do
state { total : Float }
init { total: 0.0 }
on Record(s : Shape) do
let total = state.total +. area(s)
println("total area: " ++ float_to_string(total))
{ state with total: total }
end
end
fn main(cap : Cap(IO.Console)) : () do
let ledger = spawn(Ledger)
send(ledger, Record(Circle(1.0)))
send(ledger, Record(Rect(2.0, 3.0)))
run_until_idle()
end
end
The needs line and the Cap(IO.Console) parameter on main limit what the program can do.
If anything it calls, a library included, tries to open a file or a socket, it won't compile.
The docs have more on capabilities,
linear types and
refinement types.
Use the playground in your browser, or install
march and the forge build tool:
curl -fsSL https://raw.githubusercontent.com/march-language/march/main/install.sh | shThen see Getting started.
Language
- march: compiler, runtime, standard library,
forgeand the language server - march-lean: Lean 4 proofs about the type system and Perceus/FBIP
- setup-march: GitHub Action that installs March in CI
- march-language.github.io: the website
Libraries
Tools
- march_doc: documentation generator
- scroll: notebooks stored as plain Markdown
- sigil: static site generator
File issues and pull requests in the repo they're about. Anything to do with the language or compiler goes to march-language/march.
