Gleam's powerful static type system helps find and prevent bugs at compile time, long before it reaches your users. It also serves as a productive refactoring tool, enabling programmers to confidently make large changes to unfamiliar code, quickly and with low risk.
For problems the type system can't solve (such as your server being hit by a bolt of lightning) the Erlang virtual machine provides well tested mechanisms for gracefully handling failure.
Hunting down bugs can be stressful so Gleam's compiler provides clear and helpful feedback about any problems. We want to spend more time developing features and less time looking for bugs or deciphering cryptic error messages.
As a community we want to be friendly too. People of all backgrounds, genders, and experience levels are welcome and must receive equal respect. See our community code of conduct for more.
Gleam builds on top of the Erlang virtual machine, a best-in-class runtime that has enabled companies such as Discord, Ericsson, Heroku, and WhatsApp to provide low-latency services at a global scale. Gleam takes full advantage of the Erlang runtime and adds no overhead of its own, so all Gleam programs are as fast and as efficiently multi-threaded as their Erlang counterpart.
Gleam makes it easy to use code written in other BEAM languages such as Erlang, Elixir and LFE, so there's a rich ecosystem of thousands of open source libraries for Gleam users to make use of.
In return Gleam code can be easily used by programmers of other BEAM languages, either by transparently making use of libraries written in Gleam, or by adding Gleam modules to their existing project with minimal fuss.
import gleam/io
pub fn main() {
io.println("Hello, world!")
}
import gleam/io
import gleam/bit_builder
import gleam/http/elli
import gleam/http/response
pub fn my_service(_req) {
let body = bit_builder.from_string("Hello, world!")
response.new(200)
|> response.set_body(body)
}
pub fn main() {
elli.become(my_service, on_port: 3000)
}
The web server created by this code is fully asynchronous and
multi-threaded, seamlessly making use of all the cores of your computer
without tricky locks, callbacks, or promises.
import gleam/io
import gleam/int
import gleam/list
import gleam/string
import gleam/otp/process
pub fn main() {
list.range(0, 1000)
|> list.map(start_process)
|> list.map(process.monitor_process)
|> list.each(process.receive(_, 3)) // Wait for them to finish
}
fn start_process(i) {
process.start(fn() {
let message = string.append("Hello world: ", int.to_string(i))
io.println(message)
})
}
In addition to this low-level process abstraction Gleam has helpful
libraries full of building blocks for writing type safe and fault
tolerant multi-core programs as quickly as possible.
Still interested? Try out getting started guide:
Get Started