V0.13 of Gleam, a type safe back-end language that runs on the Erlang VM, is out

Hello everyone! I’ve just released the latest version of Gleam, a type safe back-end language that attempts to unify the best parts of Elm, Erlang, and a few other languages too.

It features a powerful type system and friendly error messages similar Elm, and it has all the multi-core speed and fault tolerance of Erlang, making it (in my opinion!) a delightful language for writing backend web applications and APIs in.

Elm has been a big inspiration so I thought I would share Gleam here in case you find it to your liking.

Here’s the blog post on the latest release:

Here’s the website with more general information: https://gleam.run
And here’s the code on GitHub: GitHub - gleam-lang/gleam: ⭐️ A statically typed language for the Erlang VM

Thank you! :sparkles:

28 Likes

I am very interested in Gleam, since I already use Elixir. I have some questions:

  1. How production ready is Gleam at the moment? Would you advise us to use it at a side project, to use in an internal project or it is ready to develop a real product?

  2. How is the interop with the elixir/erlang ecossystem? Can I use all features of Ecto/Phoenix/LV/OTP?

  3. Albeit not being pure, does it have holes or partial functions in the type system? Or every function is safe and every error detected at compile time?

  4. Do you work full time on the project?

1 Like

There is a FAQ which shoud answer (1 & 3)

Should I put Gleam in production? Gleam is a young language that has not reached version 1.0, so while it is robust it is likely to undergo breaking changes in the future, and there may be some annoying bugs in there somewhere. The Gleam ecosystem is also quite young, so many libraries that are found in other languages will need to be written, or Erlang/Elixir libraries will have to be used in place of pure Gleam versions.

Does Gleam have side effects? Yes, Gleam is an impure functional language like OCaml or Erlang, so impure actions like reading to files and printing to the console is possible without special handling. We may later introduce an effects system for identifying and tracking any impure code in a Gleam application, though this is still an area of research.

Since Gleam is compiled to Erlang external functions should answer (2)

2 Likes

Thanks to the Erlang runtime Gleam is very reliable in production, and I know of two companies that use it in production, one of which use it as their primary language.

The main problem is that it’s a very new ecosystem, so there’s a shortage of documentation and libraries. You’ll likely be using Erlang or Elixir libraries a lot, so it helps to be familiar with them.

Straightforward interop is one of the main goals of Gleam, and we’ve had great success. Interop between Gleam and Erlang in my opinion works better than interop between Erlang and Elixir for example. It’s very easy to use Gleam from other BEAM languages and to use other BEAM languages from Gleam.

As an Erlang library OTP is very usable, and we have our own type safe version of OTP that is fully compatible.

Ecto, Phoenix, and LiveView are not fully usable from other BEAM languages because they make heavy use of Elixir’s metaprogramming features. This is a shame, but it is out of our control. They are not usable from Erlang either.

It is possible to use Gleam (or Erlang) alongside them though, so long as Elixir glue code is used to interface with them directly. This game emulator project has the virtual machine written in Gleam with the UI written in LiveView + Pheonix.

Additionally I think Gleam can do better than Ecto and Phoenix. They are untyped, while a future Gleam alternative would be fully type safe.

Albeit not being pure, does it have holes or partial functions in the type system? Or every function is safe and every error detected at compile time?

There are no crashing functions in the standard library, though like in Elm is it possible to write functions that diverge by creating an infinite loop.

You can write functions that crash using the assert keyword if you want to opt-in to the Erlang behaviour.

Exhaustiveness checking is still WIP but once we have that we will have the same level of safety as Elm, assert aside.

Do you work full time on the project?

I have done for a year or two, but recently I ran out of money and had to find employment.

7 Likes