NOTE: This manual is a work in progress. Please let us know if you think something is missing by filing an issue, or join our Discord server.
Hello, Joe!
The BEAM community has had a tradition of writing Hello World programs where we say Hello to Joe Armstrong, one of the creators or Erlang.
We can do this by creating a new file, called hello_joe.ml
with the following
contents:
let hello () = Io.format "~p" ["Hello, Joe!"]
Now we can compile this by calling caramel compile hello_joe.ml
:
$ ls
hello_joe.ml
$ caramel compile hello_joe.ml
$ ls
hello_joe.ml hello_joe.erl
Our new compiled file, hello_joe.erl
should looks like this:
% Source code Generated by Caramel
-module(hello_joe).
-export([hello/0]).
hello() -> io:format(<<"~p">>, [<<"Hello, Joe!">>]).
Now we can compile and run this Erlang code