Gleam (programming language)

Gleam is a general-purpose, concurrent, functional high-level programming language that compiles to Erlang or JavaScript source code.

Gleam is a statically-typed language, which is different from the most popular languages that run on Erlang’s virtual machine BEAM, Erlang and Elixir. Gleam has its own type-safe implementation of OTP, Erlang's actor framework. Packages are provided using the Hex package manager, and an index for finding packages written for Gleam is available.

History
The first numbered version of Gleam was released on April 15, 2019. Compiling to JavaScript was introduced with version v0.16.

In 2023 the Erlang Ecosystem Foundation funded the creation of a course for learning Gleam on the learning platform Exercism.

Version v1.0.0 was released on March 4, 2024.

Example
A "Hello, World!" example:

Gleam supports tail call optimization:

Implementation
Gleam's toolchain is implemented in the Rust programming language. The toolchain is a single native binary executable which contains the compiler, build tool, package manager, source code formatter, and language server. A WebAssembly binary containing the Gleam compiler is also available, enabling Gleam code to be compiled within a web browser.