The following PureScript function:
add :: Number -> Number -> Number
add a b = a + b
... compiles to JavaScript as follows:
var add = function (a) {
return function (b) {
return a + b;
};
};
I would like to call this function on iOS using the JavaScriptCore framework and this makes it more complicated than it needs to be. Is there a way to compile to uncurried functions?
Take a look at the functions in Data.Function.Uncurried - the mkFnN helpers will allow you to define JS multi-argument functions from the PS-curried versions.
The tradeoff is you won't be able to call these functions the normal way in PS, you'll have to use the corresponding runFnN also. Not really an issue if this module is only exposing an FFI interface though. :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With