hamler-lang / hamler

Haskell-style functional programming language running on Erlang VM.
https://www.hamler-lang.org/
BSD 3-Clause "New" or "Revised" License
1.03k stars 39 forks source link

(feat) also output full parameters functions aliases (/2 /3 ...) #349

Open sdancer opened 4 years ago

sdancer commented 4 years ago

currently the compiler generates this functions, (useful for composition on hamler):

'and'/1 = fun(_0) -> fun(_1) -> let <_2, _3> = <_0, _1> in case <_2, _3> of <'true', 'true'> when 'true' -> 'true' <_100, _101> when 'true' -> 'false' end

can have it generate the /2 alias too, something like (useful for calling hamler from other langs), hamler itself wouldn't use or call these, although it could as a compiler optimization

'and'/2 = let <_2, _3> = <_0, _1> in case <_2, _3> of <'true', 'true'> when 'true' -> 'true' <_100, _101> when 'true' -> 'false' end

emqplus commented 4 years ago

@lissana Yes. It's inconvenient to call the functions generated by Hamler in Erlang/Elixir now, for the functions in Hamler are curried when compiled to CoreErlang.

@EMQ-YangM could we generate uncurried functions in CoreErlang?