Gleam - have you used it?

If so, where/how and what do you like about it? :003:

Created by @lpil

Why Gleam?

Safe

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.

Friendly

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.

Performant

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.

Erlang compatible

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.

Features

  • Actor based multi-core concurrency
  • Algebraic data types
  • Erlang style fault tolerance
  • Fast compilation
  • Full type inference
  • Generics
  • Helpful error messages
  • Immutable data structures
  • No exceptions by default
  • No null
  • No undefined behaviour
  • Reliable package management
  • Small and consistent language design
  • Zero cost interop with Erlang, Elixir, etc
3 Likes

Yes, once or twice. I think it’s pretty good :wink:

26 Likes

You would :laughing:

I’ve long thought that until Gleam has a web framework and ecosystem that rivals Elixir & Phoenix, I’d use it for core business logic. I recently saw Application with Elixir, business logic with Gleam and I think this is a great way forward for Gleam.

4 Likes

:081:

Seriously tho, what are your favourite aspects about it Louis?

Personally I am particularly interested in how you are now able to compile to JS - that’s very cool! :sunglasses:

1 Like

For me the virtuous feature of Gleam is the focus on user experience, something we largely learnt from Elixir. It should be as easy to learn and as enjoyable to use as possible.
Programming can be hard and at times stressful, so I want Gleam to improve the day of anyone using it.

And of course, all the great properties of the BEAM apply to Gleam.

6 Likes

If gleam compile to beam files I guess you could build gleam applications on Nova and create web framework. We did this with LFE.

So maybe it is not that much work to get it running with Gleam.

4 Likes

That really really is such a big thing for a modern language!

3 Likes

I’m sure you could! This would be a fun project to explore

2 Likes

Yesterday I was forced to work on a C# project in Visual Studio and I was determined to hate it.
And while it’s really a language I do not want to use, the combination of a statically typed language and a strong IDE was really impressive. I’d love to have that for the BEAM. Gleam looks wonderful. As soon as Implement language server protocol · Issue #180 · gleam-lang/gleam · GitHub is done, I’ll definitely use it for the core/business logic. Elixir and Gleam will be a dream-team.

5 Likes

Anyone here using Gleam?

4 Likes

Some :wink:
Gleam - have you used it? (edit by mod: thread/last two posts merged into this one << :- )

4 Likes

This is a post from 2021 → currently in 2025 i wanted to give an update on the state of coming to Gleam in 2025

I have used Gleam as my main language for 3 months now and its wonderfull …I am coming from js land and i looked into ways of building reliable web apps ( i don’t want to see “undefined is not a function” ever )

i got intrested in Gleam because of Lustre Framework it combines Ideas from Elm language and Phonix liveview

Using Lustre and Gleam was so nice no runtime exception or weird bugs if the project compile it will just work

And then i needed to make a websocket server for my web app so i dived into Mist a web server made in Gleam

Using it was easy also reached out for a Process Registry library in Gleam (Chip) simmilar to Syn if you used it before

i used it to group websocket connection into groups i can broadcast messages to each member of a specific group (in my case users collaborating in the same document)

Also I have used Bravo a library for ETS bindings for Gleam so i can store the current state of documents and save the ETS table to a file for persistence when i close the server and reopen it

i wanted to give an overview of what it feels like to build a project in Gleam nowdays ^ also some nice to have features of the language are

Gleam has typesafe OTP reimplementation of OTP in Gleam

the language server is now top-tier i really enjoy it it also gives pretty printed warnings and errors with line numbers and whats wrong highlighted in the terminal and how to fix it

refactoring is so nice you can be confident that if you switch things around as long as the types are correct no bugs will be interdoced

Also one major benifit for me is FFI you can wrap a Javascript/Erlang/Elixir functions and use them from Gleam as if they were written in Gleam its really useful

Also you can make a gleam library that targets both JavaScript and Erlang for example a library for using sqlite with Gleam This library wraps an Erlang library for sqlite (Esqlite) and when compling to JavaScript it wraps a library for using sqlite with deno

3 Likes

I’m learning Gleam and I love it.

For decades I’ve wanted to use Erlang in a commercial environment…but the companies have all favored C, Java, or Python.

However, IMHO, there is a confluence of issues that will push Gleam (and the BEAM) into prime time:

  • types
  • community
  • libraries

types: Using Gleam feels like using Python3 with type annotations and MyPy. Which also feels a lot like using Java… so there’s this group of developers that now have an easy way to transition to the BEAM. I’m one of those developers. Note: I actually like the Erlang syntax but I find writing code in Gleam to be more intuitive.

community: The Gleam community is really active. I’ve posted a number of questions and @lpil answered them, quickly and nicely. I’ve read through hundreds of posts and the tone in the slack is consistently friendly and open. Same with the dozens of PRs and Issues in the github repos. It’s just an all around really nice group of people.

libraries: There are loads of cool libraries but one thing that I noticed in a CodeBeam talk recently is that that Actors just looks so clean and easy to use. That said, there’s a bunch of things I’ve never quite understood about Erlang/BEAM… behaviors being one of them.

I think that this language is what’s going to enable me to sell the BEAM to the company I work for. If not, then I’ll look for another company :slight_smile:

On a personal note, I recently bought a small kindle and re-purchased all the Erlang books I could find and loaded them up. For many of these books, this will be the 3rd or 4th time I’ve read them. I’ll be hiking the Pacific Crest Trail…and I plan to read about the wonders of Erlang while camping out under the stars. Hopefully, this time it’ll stick and I’ll finally understand it all.

2 Likes

Thank you for the kind words!