Skip to content

Curried functions does not compile properly #14

@danielo515

Description

@danielo515

Hello,

This is probably a problem because how LS compiles to AST.
I have been checking and it produces the same AST for normal and curried functions, which is probably what confuses your compiler.
Here is a small example, the following code produces:

add = (a, b) --> a + b

console.log add 3 4
let add;

add = function (a, b) {
  return a + b;
};

console.log(add(3, 4));

As you can see, the curry function is left behind. Of course this can be fixed by manually currying the function, which is not too bad

add = (a) -> (b) -> a + b

console.log add 3 <| 4

In fact I really like this because it looks a lot like HMS signatures ( I would love to remove the parens, but that is another story).

In any case, I think it's worth mentioning

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions