Gentype curried function

I am trying to interop with a typescript project. I want to export a rescript function as a curried function. Something like below.

@gentype
let fn = (a, b) => {
    (c, d) => // Some action here
}

This didnt work first. So I rewrote it like below. So rescript compiler, compiles it into a curried function.

let identity = a => a

@gentype
let fn = (a, b) => {
    let sameA = a->identity
    (c, d) => // Some action here
}

This :point_up_2:t3: gets compiled to curried function correctly. However gentype creates the type of function as uncurried. Something like below.

type fn = (a: A, b: B, c: C, d: D) => R

But it should be created like Below

type fn = (a: A, b: B) => (c: C, d: D) => R

Please advise.

Hi @praveen .
Can you try

let fn = (. a, b) => {
  (. c, d) => a + b + c + d
}

Playground

1 Like

@a-c-sreedhar-reddy Thank you very much. That worked like a charm.