Skip to content
@march-language

March Language

Org for the development of the March programming language

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.

Try it

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 | sh

Then see Getting started.

Repositories

Language

Libraries

Tools

  • march_doc: documentation generator
  • scroll: notebooks stored as plain Markdown
  • sigil: static site generator

Contributing

File issues and pull requests in the repo they're about. Anything to do with the language or compiler goes to march-language/march.

Pinned Loading

  1. march march Public

    March is a statically-typed functional language: actors and message passing from the BEAM, algebraic data types from ML, compiled to native binaries through LLVM.

    OCaml 28 1

  2. sigil sigil Public

    A small static-site generator written in March: Markdown + front-matter to HTML, with custom layouts, tag/RSS/sitemap collections, and a live-reload dev server.

  3. march-language.github.io march-language.github.io Public

    March language website

    HTML

Repositories

Showing 10 of 11 repositories

People

This organization has no public members. You must be a member to see who’s a part of this organization.

Top languages

Loading…

Most used topics

Loading…