Gleam
Statically-typed functional programming language that runs on the Erlang BEAM VM and compiles to JavaScript. Gleam brings Elm-inspired type safety to the BEAM ecosystem — no runtime errors from type mismatches, exhaustive pattern matching, and friendly compiler error messages. Unlike Elixir (dynamic), Gleam is fully type-inferred with compile-time guarantees. Runs alongside Elixir and Erlang code, shares BEAM's concurrency and fault tolerance. Gleam 1.0 released in 2024.
Score Breakdown
⚙ Agent Friendliness
🔒 Security
Static type system prevents entire classes of runtime errors. BEAM fault tolerance. No reflection or unsafe casts. Immutable data structures prevent race conditions.
⚡ Reliability
Best When
You want Erlang BEAM's concurrency and fault tolerance with ML-style type safety, or you're writing a new BEAM service and want compile-time guarantees over Elixir's dynamic approach.
Avoid When
You need the rich Elixir/Erlang ecosystem — Gleam's package ecosystem is young. Elixir with Dialyzer covers most type safety needs with a vastly larger library ecosystem.
Use Cases
- • Build type-safe BEAM services for agent backends where Gleam's compile-time type checking prevents runtime errors in production
- • Share BEAM VM infrastructure (supervisors, processes, distributed Erlang) with existing Elixir apps while writing new agent code in Gleam for type safety
- • Compile agent frontend code to JavaScript using Gleam's JS target — same type-safe language for both BEAM backend and browser frontend
- • Write Gleam libraries that interop with Elixir — Gleam modules callable from Elixir and vice versa, enabling gradual adoption in Elixir codebases
- • Build event-driven agent services with BEAM OTP patterns (GenServer equivalent via gleam_otp) with Gleam's type safety
Not For
- • Teams not using BEAM ecosystem — Gleam runs on BEAM; use Elm, F#, or Haskell for typed functional programming without BEAM
- • Large ecosystem requirement — Gleam's package ecosystem is small compared to Elixir or mainstream languages; many libraries require FFI wrappers
- • Teams expecting Ruby/Python ergonomics — Gleam is functional and statically typed; metaprogramming (Elixir macros) is not available
Interface
Authentication
Programming language — no auth concepts. Gleam HTTP libraries (wisp, glen) implement auth as middleware.
Pricing
Gleam is Apache 2.0 licensed, created by Louis Pilfold. Free for all use. hex.pm hosts Gleam packages.
Agent Metadata
Known Gotchas
- ⚠ Small standard library — Gleam's stdlib is intentionally minimal; many common tasks (regex, date handling, advanced HTTP) require third-party packages from hex.pm which may be immature
- ⚠ Gleam uses Result type, no exceptions — all errors must be handled via case result { Ok(v) -> ... Error(e) -> ... }; forgetting error branches is a compile error
- ⚠ JavaScript target differences — Gleam code compiled to JS doesn't have BEAM OTP features (supervisors, processes); JS target is for browser/Node.js, BEAM target for server
- ⚠ Erlang interop requires extern blocks — calling Erlang/Elixir from Gleam requires @external annotations; type safety at FFI boundary is developer responsibility
- ⚠ No macros or metaprogramming — Gleam is intentionally meta-programming free; complex DSLs or code generation that Elixir handles with macros require build-time codegen tools
- ⚠ Package ecosystem is small — hex.pm has Gleam packages but far fewer than Elixir; many agent use cases require writing Gleam wrappers around Erlang/Elixir libraries
Alternatives
Full Evaluation Report
Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for Gleam.
Scores are editorial opinions as of 2026-03-06.