Closed michallepicki closed 3 years ago
This may be a good point to start: https://github.com/AbstractMachinesLab/caramel/blob/main/caramel/compiler/ocaml_to_erlang/fun.ml#L399
I will look into this one
With #80 as of e2f88eb we're getting this output:
% Source code generated with Caramel.
-module(main).
-export([main/1]).
-export([print/1]).
-spec print(_) -> ok.
print(Thing) -> io:format(<<"~0tp~n">>, [Thing | []]).
-spec main(_) -> ok.
main(_) -> print(begin
print(<<"hej">>),
true
end).
and it runs:
$ caramel compile main.ml
Compiling main.erl OK
$ escript main.erl
<<"hej">>
true
Describe the bug When combining multiple OCaml expressions with
( expr1 ; expr2 )
orbegin expr1 ; expr2 end
, the resulting Erlang code is "flattened" and can have different result than expected or not compile at all.To Reproduce
main.ml
containinglet main _ = print ( print "hej" ; true )
caramel compile main.ml && escript main.erl
This happens because of this incorrect generated Erlang code:
Expected behavior Erlang gets generated with:
Environment (please complete the following information):