I have a JS function that I want to convert to Reason syntax.
function hoc() {
return (a, b) => {
return a + b
}
}
So this function once called returns another function that takes 2 arguments.
hoc() // returns new function
When called again it then takes the 2 arguments provided and adds them together.
I’m finding trouble converting it to reasonml because of the following issue.
If I have the function writen as follows in reasonml syntax
let hoc = () => {
(a, b) => {
a++b
}
};
it gets converted to
function hoc(param, a, b) {
return a + b;
}
which isn’t what I want. I want the HOC function when first called to take no parameters then take the rest later on
How do I solve this?