Crowdhailer
How to get gleam standard library to work in a mix project
I have followed this guide on adding Gleam to an Elixir project.
I’ve tweaked it somewhat as I am adding to a pure Elixir project, no phoenix.
Gleam code written in my project works but I am not able to get any gleam libraries to work.
This unfortunately includes the Gleam standard library.
I suspect there is some mix option that says I need to use the compilers for the libraries, but can’t work it out.
Here is the exact version of the code I am trying to run https://github.com/midas-framework/elixir_with_gleam
Running mix compile gives the following error.
error: Unknown import
┌── /opt/app/src/hello.gleam:1:8 ───
│
1 │ import gleam/string
│ ^^^^^^^^^^^^ did you mean `hello`?
│
The module `hello` is trying to import the module `gleam/string`,
but it cannot be found.
Marked As Solved
lpil
Thanks for this, super cool!
I’ve packaged up this idea into a tiny library to make it easier to use Gleam from Elixir in future -> https://github.com/gleam-lang/mix_gleam/
Also Liked
Crowdhailer
I got it working.
Here is an example project.
Crowdhailer
Great.
I’ve also updated https://github.com/midas-framework/elixir_with_gleam to reflect the changes








