Erlang's concurrency model is legendary. But Erlang's syntax scares most developers away. Gleam brings modern type safety and friendly syntax to the BEAM VM — get Erlang reliability with Rust-like developer experience.
What Is Gleam?
Gleam is a functional programming language that runs on the BEAM (Erlang VM) and compiles to JavaScript. It has a Rust-inspired syntax, a strong type system with type inference, and full interop with Erlang and Elixir libraries. No runtime errors from type mismatches.
Why Gleam Is Different
- Type-safe BEAM: Catch errors at compile time, not in production
- Friendly syntax: Rust-like, not Prolog-like (looking at you, Erlang)
- BEAM + JavaScript: Same code runs on server and in browser
- OTP interop: Use GenServers, supervisors, and all OTP patterns
- Package manager: Built-in hex.pm integration
- LSP: First-class editor support
- Completely free and open source
Quick Start
Install Gleam:
brew install gleam
Create a project:
gleam new my_app
cd my_app
gleam run
Write type-safe code:
import gleam/io
import gleam/string
import gleam/list
import gleam/int
pub type User {
User(name: String, email: String, age: Int)
}
pub fn greet(user: User) -> String {
"Hello, " <> user.name <> "! You are " <> int.to_string(user.age)
}
pub fn adults(users: List(User)) -> List(User) {
list.filter(users, fn(user) { user.age >= 18 })
}
pub fn main() {
let users = [
User("Alice", "alice@example.com", 30),
User("Bob", "bob@example.com", 17),
User("Charlie", "charlie@example.com", 25),
]
users
|> adults
|> list.map(greet)
|> list.each(io.println)
}
Pattern matching:
pub type Shape {
Circle(radius: Float)
Rectangle(width: Float, height: Float)
}
pub fn area(shape: Shape) -> Float {
case shape {
Circle(r) -> 3.14159 *. r *. r
Rectangle(w, h) -> w *. h
}
}
pub type Result(value, error) {
Ok(value)
Error(error)
}
pub fn divide(a: Float, b: Float) -> Result(Float, String) {
case b {
0.0 -> Error("Division by zero")
_ -> Ok(a /. b)
}
}
Build a web server with Wisp:
import wisp.{type Request, type Response}
import gleam/http
pub fn handle_request(req: Request) -> Response {
case req.method, wisp.path_segments(req) {
http.Get, [] -> wisp.ok() |> wisp.string_body("Hello, World!")
http.Get, ["users"] -> list_users()
http.Post, ["users"] -> create_user(req)
_, _ -> wisp.not_found()
}
}
Why Developers Choose Gleam
An Elixir team loved the BEAM but kept hitting runtime errors from misspelled function names and wrong argument types. After adopting Gleam for new services, those errors disappeared entirely. The compiler caught every type mismatch, and they still used their existing Elixir libraries through interop.
Who Is This For?
- Elixir/Erlang developers wanting type safety on the BEAM
- Rust developers curious about functional programming on the BEAM
- Web developers wanting BEAM reliability with modern syntax
- Anyone interested in type-safe concurrent programming
Try Gleam
Gleam makes the BEAM accessible to developers who want type safety and modern syntax. All the reliability of Erlang, none of the syntax barriers.
Need help with concurrent systems or BEAM applications? I build custom backend solutions — reach out to discuss your project.
Found this useful? I publish daily deep-dives into developer tools and APIs. Follow for more.
Top comments (0)