-
-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Partial function application compiles to wrong erlang #44
Comments
I think it may be because I thought there is an -export([hello/1]).
-spec hello(list(any())) -> ok.
hello(args) -> io:format(text(), args). ? -export([hello/0]).
-spec hello() -> fun((list(any())) -> ok).
hello() -> fun
args -> io:format(text(), args)
end. ? |
Also tried on |
Thanks for filing this! Since Caramel is an ML, we do partial application by default. When you called You're correct that this is a bug because the signature of The right signature should be |
-export([hello/1]).
-spec hello(list(any())) -> ok.
hello(Args) -> io:format(text(), Args). This doesn't quite track because in the Caramel source you still have to call |
-export([hello/0]).
-spec hello() -> fun((list(any())) -> ok).
hello() -> fun (Args) -> io:format(text(), Args) end. This would be the Right Thing ™️, but is highly unidiomatic Erlang code. |
I look into this. |
So I suppose I should implement the Right Thing, even if it is highly unidiomatic? |
I tried:
test_hello.ml
then which leads to no error, a If I try with test_ocaml.ml
and I do Is that normal that |
@nicobao yes, I think they're ignored but they probably should fail with an error (just like The automatic uncurrying can be done (as shown by BuckleScript), but that's a larger task than undoing the work I did for it. Let's start there, translating the functions as they are, and we can optimize later 🙌🏽 |
Describe the bug
A simple function that taking no arguments in Caramel, that only runs
Io.format
, compiles to invalid erlang that says it is taking two arguments, which erlang/OTP cannot compile.To Reproduce
Expected behaviour
.erl
gets created withThe text was updated successfully, but these errors were encountered: