zlacker

I tried Gleam for Advent of Code

submitted by tymsca+(OP) on 2025-12-13 17:00:14 | 351 points 208 comments
[view article] [source] [go to bottom]

NOTE: showing posts with links only show all posts
19. croisi+ka[view] [source] 2025-12-13 18:18:25
>>tymsca+(OP)
fortunately the blog title police stepped in as soon as possible >>45426996
◧◩
27. sbuttg+Ed[view] [source] [discussion] 2025-12-13 18:39:58
>>bnchrc+56
> For those that don't know its also built upon OTP, the erlang vm

This isn't correct. It can compile to run on the BEAM: that is the Erlang VM. OTP isn't the Erlang VM; rather, "OTP is set of Erlang libraries and design principles providing middle-ware to develop [concurrent/distributed/fault tolerant] systems."

Gleam itself provides what I believe is a substantial subset of OTP support via a library: https://github.com/gleam-lang/otp

Importantly: "Gleam has its own version of OTP which is type safe, but has a smaller feature set. [vs. Elixir, another BEAM language with OTP support]"

◧◩◪◨⬒
72. WJW+5m[view] [source] [discussion] 2025-12-13 19:48:26
>>tymsca+Gk
There is though?

https://tour.gleam.run/flow-control/guards/

◧◩◪◨
87. culi+5t[view] [source] [discussion] 2025-12-13 20:39:28
>>scuff3+Hg
https://iselmdead.info/

I can't believe this is still up tbh. And I can't believe there's still people defending Elm's lack of development

> It’s true that there hasn’t been a new release of the Elm compiler for some time. That’s on purpose: it’s essentially feature-complete.

Last talk I saw by Evan Czaplicki (from the 2025 Scala Days conf) he seemed to be working on some sort of database language https://www.youtube.com/watch?v=9OtN4iiFBsQ

◧◩◪
90. riffra+Zt[view] [source] [discussion] 2025-12-13 20:45:11
>>akkad3+1e
the comment is wrong, what Gleam lacks is interfaces.

Which feels super strange, but doesn't seem to really be a problem, e.g. imagine a language where you'd write

    fun sum_all_numbers(Iterable<T> it) { it.fold(...) } # an interface
    sum_all_numbers(a_list) # a list implements iterable

Gleam wants you to write

    fun sum_all_numbers(Iterator<T> it) { it.fold(...) } # a concrete type
    sum_all_numbers(a_list.iterator) # get the caller to build the right object

edit: found an article that explained this a bit better https://mckayla.blog/posts/all-you-need-is-data-and-function...
◧◩◪◨
110. sbuttg+7I[view] [source] [discussion] 2025-12-13 22:19:15
>>lpil+ai
Fair enough, but to be fair to my statements, the quotes I chose were largely from gleam-lang.org or the Gleam OTP library.

Take for example this section of the Gleam website FAQ section:

https://gleam.run/frequently-asked-questions/#how-does-gleam...

"Elixir has better support for the OTP actor framework. Gleam has its own version of OTP which is type safe, but has a smaller feature set."

At least on the surface, "but has a smaller feature set" suggests that there are features left of the table: which I think it would be fair to read as a subset of support.

If I look at this statement from the Gleam OTP Library `readme.md`:

"Not all Erlang/OTP functionality is included in this library. Some is not possible to represent in a type safe way, so it is not included. Other features are still in development, such as further process supervision strategies."

That quote leaves the impression that OTP is not fully supported and therefore only a subset is. It doesn't expound further to say unsupported OTP functionality is alternatively available by accessing the Erlang modules/functions directly or through other mechanisms.

In all of this I'll take your word for it over the website and readme files; these things are often not written directly by the principals and are often not kept as up-to-date as you'd probably like. Still even taking that at face value, I think it leaves some questions open. What is meant by supporting all of OTP? Where the documentation and library readme equivocates to full OTP support, are there trade-offs? Is "usable as normal" usable as normal for Erlang or as normal for Gleam? For example, are the parts left out of the library available via directly accessing the Erlang modules/functions, but only at the cost of abandoning the Gleam type safety guarantees for those of Erlang? How does this hold for Gleam's JavaScript compilation target?

As you know, Elixir also provides for much OTP functionality via direct access to the Erlang libraries. However, there I expect the distinction between Elixir support and the Erlang functionality to be substantially more seamless than with Gleam: Elixir integrates the Erlang concepts of typing (etc.) much more directly than does Gleam. If, however, we're really talking about full OTP support in Gleam while not losing the reasons you might choose Gleam over Elixir or Erlang, which I think is mostly going to be about the static typing... then yes, I'm very wrong. If not... I could see how strictly speaking I'm wrong, but perhaps not completely wrong in spirit.

◧◩◪
124. thelas+wV[view] [source] [discussion] 2025-12-14 00:14:41
>>rapind+Of
This Lustre? https://www.lustre.org/

Seems to be a filesystem, how would it replace a database?

◧◩◪◨
129. Shadow+c11[view] [source] [discussion] 2025-12-14 01:09:10
>>thelas+wV
This one is likely what they were referring to: https://github.com/lustre-labs/lustre
◧◩◪◨
130. okkdev+v11[view] [source] [discussion] 2025-12-14 01:12:07
>>thelas+wV
No, this one https://hexdocs.pm/lustre/index.html
◧◩
133. perryg+s31[view] [source] [discussion] 2025-12-14 01:33:44
>>marlie+f5
The Gleam language, yes all of it, fits in a context window (https://tour.gleam.run/everything/)

I have similar concerns to you - how well a language works with LLMs is indeed an issue we have to consider. But why do you assume that it's the volume of training data that drives this advantage? Another assumption, equally if not more valid IMO, is that languages which have fewer, well-defined, simpler constructs are easier for LLMs to generate.

Languages with sprawling complexity, where edge cases dominate dev time, all but require PBs of training data to be feasible.

Languages that are simple (objectively), with a solid unwavering mental model, can match LLMs strengths - and completely leap-frog the competition in accurate code gen.

◧◩
139. troupo+fi1[view] [source] [discussion] 2025-12-14 05:26:46
>>bnchrc+56
> what I wish Elixir would become (re:typing).

Elixir is slowly rolling out set-theoretic typing: https://hexdocs.pm/elixir/main/gradual-set-theoretic-types.h...

◧◩◪◨
153. troupo+ut1[view] [source] [discussion] 2025-12-14 08:34:48
>>tasuki+Co1
They are working towards "the real thing", whatever your definition of real is.

BTW in the 90s people tried to come up with a type system for Erlang, and failed:

--- start quote ---

Phil Wadler[1] and Simon Marlow [2] worked on a type system for over a year and the results were published in [3]. The results of the project were somewhat disappointing. To start with, only a subset of the language was type-checkable, the major omission being the lack of process types and of type checking inter-process mes-sages. Although their type system was never put into production, it did result in a notation for types which is still in use today for informally annotating types.

Several other projects to type check Erlang also failed to produce results that could be put into production. It was not until the advent of the Dialyzer [4] that realistic type analysis of Erlang programs became possible.

https://lfe.io/papers/%5B2007%5D%20Armstrong%20-%20HOPL%20II...

--- end quote ---

[1] Yes, that Philip Wadler, https://en.wikipedia.org/wiki/Philip_Wadler

[2] Yes, that Simon Marlow, https://en.wikipedia.org/wiki/Simon_Marlow

[3] A practical subtyping system for Erlang https://dl.acm.org/doi/10.1145/258948.258962

[4] https://www.erlang.org/doc/apps/dialyzer/dialyzer.html

◧◩◪
154. tome+eu1[view] [source] [discussion] 2025-12-14 08:48:02
>>tasuki+lo1
> The standard library is full of exceptions

By the way, the number of partial functions is base that throw compiler warnings is increasing, for example:

https://hackage.haskell.org/package/base-4.21.0.0/docs/Prelu...

I hope it will increase further.

◧◩
170. devale+ER1[view] [source] [discussion] 2025-12-14 14:18:47
>>bnchrc+56
I've also been wanting to make Gleam my primary language (am generally a Typescript dev), and I have not had any issue with using it with LLMs (caveat, I'm obviously still new with it, so might just be ignorant).

In fact, I'd say most of the Gleam code that has been generated has been surprisingly reliable and easy to reason about. I suspect this has to do with the static typing, incredible language tooling, and small surface area of the language.

I literally just copy the docs from https://tour.gleam.run/everything/ into a local MD file and let it run. Packages are also well documented, and Claude has had no issue looping with tests/type checking.

In the past month I've built the following, all primarily with Claude writing the Gleam parts:

- A websocket-first analytics/feature flag platform (Gleam as the backend): https://github.com/devdumpling/beacon

- A realtime holiday celebration app for my team where Gleam manages presence, cursor state, emojis, and guestbook writes (still rough): https://github.com/devdumpling/snowglobe

- A private autobattler game backend built for the web

While it's obviously not as well-trodden as building in typescript or Go or Rust, I've been really happy with the results as someone not super familiar with the BEAM/Erlang.

EDIT: Sorry I don't have demos up for these yet. Wasn't really ready to share them but felt relevant to this thread.

◧◩◪◨⬒⬓⬔⧯▣
185. lpil+hm2[view] [source] [discussion] 2025-12-14 17:48:41
>>premek+P62
We've not had any proposals for a design like that. We are open to proposals though! I wrote a blog post detailing the process here: https://lpil.uk/blog/how-to-add-metaprogramming-to-gleam/
◧◩◪◨⬒
186. ljlole+Xp2[view] [source] [discussion] 2025-12-14 18:10:22
>>Nuclea+As
https://en.wikipedia.org/wiki/Worse_is_better
◧◩
208. tymsca+8Ps[view] [source] [discussion] 2025-12-23 16:46:51
>>jgerri+FOs
Honestly it’s very much worth it! Look into this https://hexdocs.pm/hexdocs_offline/index.html
[go to top]