Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Flowtype curry function
//@flow
function curry2<A, B, R>(fn : (A, B) => R) : A => B => R {
return function (a : A) : B => R {
return function (b : B) : R {
return fn(a, b);
};
};
};
function curry3<A, B, C, R>(fn : (A, B, C) => R) : A => B => C => R {
return function (a : A) : B => C => R {
return function (b : B) : C => R {
return function (c : C) : R {
return fn(a, b, c);
};
};
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.