Skip to content
This repository was archived by the owner on Nov 23, 2017. It is now read-only.
This repository was archived by the owner on Nov 23, 2017. It is now read-only.

Currying #175

@puffnfresh

Description

@puffnfresh

One of the goals for Roy is to ensure the JavaScript output should easily be used from plain JavaScript (and hopefully other languages).

Here we want f to be a curried function:

let f a b = a + b
let g = f 42

The problem with currying each function definition is that it doesn't compile to great JavaScript:

function f(a) {
    return function(b) {
        return a + b;
    };
}
var g = f(42);

But maybe we could implement currying on the caller side?

function f(a, b) {
    return a + b;
}
function g(b) {
    return f(42, b);
}

Yes, the JavaScript it not great - but only if you use the currying. Plain JavaScript clients don't change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions