Rest parameters support? (variadic functions)

I need an actual array then? Example:

let str = (args) => (s) => JsArray2.every(args, a => a(s))
let x = str(email, min5, size(5, 15))("s")

You can use @variadic, but it’s for interop. For pure Rescript, yes, use an array. There’s not much of a practical difference (in JS runtime, all arguments are passed as an array anyway).

Mind that in Rescript v10, let str = args => s => ... is the same as let str = (args, s) => ..., because of auto-currying. (In v11 it’s not, because functions are uncurried by default.) If you really want a function that returns a function in v10, use let str = (.args) => (.s) => ... .

5 Likes