I spent a good part of the last year to write my Master’s thesis about compiling Gleam to WebAssembly 
It does not cover all Gleam features, but it's enough to do some useful things with it. Some exciting stuff includes Gleam Externals to call foreign WebAssembly functions, tail recursion and generics (through monomorphization).
I also made an example project to showcase the supported features and to compare the performance between Gleam compiled to JavaScript and Gleam compiled to WebAssembly (spoiler: wasm wins 🚀).
It’s a raytracer running in the browser, rendering to an HTML canvas (with some JS glue).
Compiler source: https://github.com/tufteddeer/gleam-webassembly
Demo: https://tufteddeer.github.io/raytracing-gleam/
I planned writing a few blog posts highlighting different aspects of the project, but since I have not managed to do that yet, I decided to publish the project right away before it ends up forgotten in a private repo.
Nonetheless, if you are interested in certain aspects feel free to reach out and I will do my best to answer or provide an english version of my thesis.
The implementation is kinda messy in some parts to be honest, but I was more focused on features and figuring out how to do stuff (I don’t have a background in compilers) than the quality of the implementation. In hindsight, I should have done more research here and there to come up with cleaner solutions but given the overall results I am still quite happy with what I achieved.

