Type for curried function in uncurried mode?

Is there a way to make a function type curried in an uncurried mode? I’ve managed to do it this way, but I wonder if there’s a better solution:

@@uncurried.swap
type curriedFn<'a, 'b> = (. 'a) => 'b
3 Likes

What’s your use case?

I don’t think there’s a better solution to have exactly regular curried functions in uncurried mode.
But if you’re trying to achieve is a way to create functions with partial applications in uncurried mode, you can manually curry them:

let multiply = (a) => (b) => a * b 
let res = Array.map([1,2,3],  multiply(10))
1 Like

I wanted to make a module work both in curried and uncurried modes during the migration phase to uncurried mode. Since we have a monorepo, the goal is to prepare as much packages as possibles and then migrate them to uncurried mode at once.

2 Likes