rescript-compiler
rescript-compiler copied to clipboard
rescript convert: incorrect conversion of function keyword
The following code example is from jscomp/stdlib-406/list.ml, but the same issue occurs in many places in the OCaml stdlib code and prevents successful conversion from OCaml syntax to ReScript syntax.
rescript convert converts
let rec mem x = function
| [] -> false
| a :: l -> compare a x = 0 || mem x l
to
let rec mem = (x, x) =>
switch x {
| list{} => false
| list{a, ...l} => compare(a, x) == 0 || mem(x, l)
}
instead of something like
let rec mem = (x, param) =>
switch param {
| list{} => false
| list{a, ...l} => compare(a, x) == 0 || mem(x, l)
}
Yes need to rename the x before converting an anonymous function from .ml.