Gleam
Created by Louis Pilfold
Gleam is a statically typed, functional programming language that compiles to Erlang bytecode (running on the BEAM virtual machine) or to JavaScript, designed to bring type safety and a friendly developer experience to the Erlang/OTP…
Definition
Gleam is a statically typed, functional programming language that compiles to Erlang bytecode (running on the BEAM virtual machine) or to JavaScript, designed to bring type safety and a friendly developer experience to the Erlang/OTP ecosystem.
Overview
Gleam was created by Louis Pilfold to make the reliability and concurrency strengths of the BEAM virtual machine — the runtime that powers Erlang and Elixir — accessible with a modern, statically typed language and a compiler that catches errors before deployment rather than at runtime. Erlang and Elixir are dynamically typed, which gives BEAM systems flexibility but leaves a class of bugs undetected until production. Gleam adds a Hindley-Milner-style type system with full type inference, so most code needs no explicit type annotations, while still guaranteeing that once code compiles, it cannot raise a whole category of type-related runtime errors. Because Gleam targets the BEAM, it interoperates directly with existing Erlang and Elixir libraries and inherits BEAM's signature strengths: lightweight actor-model concurrency (millions of isolated, garbage-collected processes), preemptive scheduling, fault tolerance through supervisor trees, and hot code upgrades. Gleam programs can also compile to JavaScript, allowing the same language and standard library to target the browser or Node.js, which makes it usable for full-stack projects that need to share code between server and client. The language emphasizes simplicity and explicitness: no null, no exceptions for control flow (errors are modeled as values via Result types), no implicit type coercion, and a small, consistent syntax. Its tooling — the `gleam` build tool, package manager, formatter, and language server — is bundled together, and its package registry (Hex, shared with Erlang and Elixir) gives it access to a mature package ecosystem. Gleam has grown a dedicated niche among developers who want BEAM's concurrency and fault-tolerance model but prefer static typing over Erlang or Elixir's dynamic typing, and it is increasingly used for web backends (via frameworks like Wisp), APIs, and concurrent systems.
Key Features
- Statically typed with full Hindley-Milner-style type inference — no type annotations required in most code
- Compiles to Erlang (BEAM bytecode) or to JavaScript from the same source
- Runs on the BEAM virtual machine, inheriting lightweight process-based concurrency and fault tolerance
- No null values or thrown exceptions — errors are modeled explicitly as Result/Option types
- Direct interoperability with existing Erlang and Elixir libraries
- Built-in tooling: compiler, formatter, package manager, and language server ship as one binary
- Uses the Hex package registry, shared with the wider Erlang/Elixir ecosystem
- Pattern matching, immutable data structures, and pipe-based function composition