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 GitHub - midas-framework/elixir_with_gleam: Running Gleam in a mix project. · GitHub
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 → GitHub - gleam-lang/mix_gleam: ⚗️ Build Gleam code with mix · GitHub

Also Liked

Crowdhailer

Crowdhailer

Creator of Raxx

I got it working.
Here is an example project.

https://github.com/midas-framework/elixir_with_gleam

Crowdhailer

Crowdhailer

Creator of Raxx

Where Next?

Popular in Questions Top

_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
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
beno
I will often find my self writing things similar to: case some_value do nil -> something() "" -> something() _ -> somethi...
New
mgjohns61585
Could someone help me? I’m making my first elixir program, number guessing game. I can’t figure out how to convert the user’s guess from ...
New
ycv005
I have followed this StackOverflow post to install the specific version of Erlang. And When I am running mix ecto.setup then getting fol...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
vegabook
I’m brand new to Phoenix and I have stripped one of the demo applications to the bone. I just want to get an svg up on the screen. Here i...
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New

Other popular topics Top

danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 29603 241
New
Nvim
Anybody knows a comprehensive comparison of Django and Phoenix, thanks for the help. Where are they similar? Where do they differ the m...
New
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New
Emily
I have VueJS GUIs with the project generated using Webpack. I have Elixir modules that will need to be used by the VueJS GUIs. I forese...
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
RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New
KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 36352 110
New

Latest on Elixir Forum

We're in Beta

About us Mission Statement