gleam-lang / playground

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Show compiled Erlang

isaacharrisholt opened this issue · comments

The code for this is mostly there on the JS side (in index.js and worker.js). We just need to add the compiled Erlang stdlib to the bundle like we do with the JS stdlib in order to get compilation working.

We just need to add the compiled Erlang stdlib to the bundle like we do with the JS stdlib in order to get compilation working.

It's not possible to execute Erlang in a browser so this isn't needed!

Agreed we should execute the JS target, but it would be nice to show the compiled Erlang output, no?

Yes but you don't need to add compiled Erlang stdlib to the bundle to do that. The only thing you need to do is ask the compiler for Erlang rather than JavaScript and it'll just work.

I tried doing that but it complained about missing libraries

Here's the specific error:

error: Function without an implementation
   ┌─ /src/gleam/float.gleam:72:1
   │
72 │ fn do_round(a: Float) -> Int
   │ ^^^^^^^^^^^^^^^^^^^^^

We can't compile this function as it doesn't have an
implementation. Add a body or an external implementation
using the `@external` attribute.

Welp. Sounds about right. That'll teach me for copy-pasting stuff and then not reading it in detail 😅

Thanks! I'll add this to #1.