Gleam (language)
Statically typed functional language for the Erlang virtual machine
Gleam is a statically typed, functional programming language that compiles to Erlang bytecode and JavaScript, designed to bring type safety and a friendly developer experience to the BEAM virtual machine ecosystem while retaining Erlang…
Definition
Gleam is a statically typed, functional programming language that compiles to Erlang bytecode and JavaScript, designed to bring type safety and a friendly developer experience to the BEAM virtual machine ecosystem while retaining Erlang and Elixir's strengths in fault-tolerant, highly concurrent systems.
Overview
Gleam was created by Louis Pilfold with the goal of offering a statically typed alternative within the BEAM ecosystem — the virtual machine originally built for Erlang and also used by Elixir — which has historically relied on dynamic typing. The BEAM is well regarded for building fault-tolerant, massively concurrent, low-latency systems (telecom switches, messaging platforms, and distributed systems), thanks to lightweight process-based concurrency and 'let it crash' supervision trees, but Erlang and Elixir's dynamic typing means many classes of errors are only caught at runtime rather than at compile time. Gleam addresses this by adding a Hindley-Milner-style static type system, similar in spirit to languages like OCaml, Elm, or Rust, with full type inference so most code doesn't require explicit type annotations while still catching type mismatches, missing pattern-match cases, and similar bugs at compile time. Its syntax is deliberately simple and consistent, avoiding the complexity of features like typeclasses or higher-kinded types found in some other statically typed functional languages, aiming for approachability and fast compile times. A key architectural choice is that Gleam compiles to core Erlang, meaning compiled Gleam code runs directly on the BEAM virtual machine and can freely interoperate with existing Erlang and Elixir libraries and OTP (Open Telecom Platform) behaviors, giving Gleam projects access to the BEAM's mature, battle-tested ecosystem rather than needing to be built from scratch. Gleam can also compile to JavaScript, letting the same language target browser or Node.js environments, which is useful for full-stack projects wanting shared code between backend BEAM services and frontend JavaScript. Gleam is aimed at teams that want BEAM's concurrency and fault-tolerance model but prefer compile-time type safety over Erlang or Elixir's dynamic typing, and it has seen growing adoption for web backends (via frameworks like Wisp), distributed systems, and JavaScript-target frontend experiments, though its ecosystem remains considerably smaller and younger than Erlang's or Elixir's.
Key Features
- Static, Hindley-Milner-style type system with full type inference
- Compiles to Erlang (BEAM bytecode) and to JavaScript from the same source
- Full interoperability with existing Erlang and Elixir libraries and OTP
- Inherits BEAM's lightweight process concurrency and fault-tolerant supervision model
- Simple, consistent syntax intentionally avoiding advanced type-system complexity
- No null values or exceptions by default; uses Result and Option-style types
- Fast compile times relative to other statically typed functional languages
- Built-in build tool and package manager for dependency management
Use Cases
Alternatives
History
Gleam is a statically typed, functional programming language that runs on the Erlang BEAM virtual machine (and can also compile to JavaScript), pairing modern, friendly language design with the battle-tested concurrency and fault-tolerance of the Erlang ecosystem. It was created by Louis Pilfold, who first began the project in 2016; its type system draws inspiration from Elm, OCaml, and Rust, and it includes a type-safe take on Erlang's OTP actor framework. Gleam's first numbered release came in 2019, and the language reached its stable 1.0 in 2024. It has attracted attention for bringing static types and polished tooling to a platform historically dominated by dynamically typed languages.
Sources
- Gleam — official website · as of 2026-07-17
- InfoWorld — "Gleam language available in first stable release" · as of 2026-07-17