Crowdhailer

Crowdhailer

Creator of Raxx

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

lpil

Creator of Gleam

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

Crowdhailer

Creator of Raxx

I got it working.
Here is an example project.

Crowdhailer

Crowdhailer

Creator of Raxx

Great.

I’ve also updated https://github.com/midas-framework/elixir_with_gleam to reflect the changes

Where Next?

Popular in Questions Top

vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
LegitStack
I’m hoping you guys can give me some general advice and perhaps code examples if you’re feeling up to it. I’m very interested in Elixir,...
New
pgiesin
This should be a simple problem but I just can’t seem to figure it out. I have a standalone Elixir app that won’t find the database. Dep...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
Jim
As a follow up to my earlier question: I have the code compiling and running but not getting a successful login from the rest server. ...
New
vac
Hi, I'm quite new in Elixir and I'm trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and ...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New

Other popular topics Top

josevalim
Hi everyone, One of the features added to Elixir early on to help integration with Erlang code was the idea of overridable function defi...
New
sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
977 41022 311
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod -- where is this set? Thanks.
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: https://hexdocs.pm/ecto/Ecto.Schema.html#module-...
New
malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New

We're in Beta

About us Mission Statement