Hi,
I have this code:
@module external picomatch: string => (string => bool) = "picomatch"
let main = () => {
let isMarkdown = picomatch("**/*.md")
isMarkdown("")
}
let _ = main()
Which compiles to:
'use strict';
var Picomatch = require("picomatch");
function main(param) {
return Picomatch("**/*.md", "");
}
main(undefined);
exports.main = main;
/* Not a pure module *
which obviously is wrong (the calls to picomatch
and isMarkdown
are combined into one call of picomatch
).
It seems the compiler thinks picomatch
accepts two arguments (when I uncurry picomatch
, I get “This function has arity2 but was expected arity1
”), but I don’t get why. So I assume, my binding is wrong.
I worked arround the problem by doing:
type picoMatcher = string => bool
@module external picomatch: string => picoMatcher = "picomatch"
But I’m still not sure if my first binding is wrong, or if the compiler is wrong.
I think the compiler should interpret string => (string => bool)
as “a function that accepts a string and returns a function that accepts a string and returns bool” because the returned function is wrapped in parentheses. Am I wrong?