rescript-compiler icon indicating copy to clipboard operation
rescript-compiler copied to clipboard

[bug?] functors are not uncurried

Open tx46 opened this issue 2 months ago • 2 comments

module type T = {
  let foo: string
}

module F = (X: T, Y: T) => {
}

module C = F({let foo = "bar"})
C.whatever()

gives error:

Type Errors
[E] Line 9, column 0:

The module C is a functor, not a structure

but it would likely be more helpful to error on the line above (could be way separated from C.whatever() in practice) and say that the functor is missing an argument.

tx46 avatar Oct 09 '25 07:10 tx46

That error message can definitely be made clearer.

zth avatar Oct 13 '25 06:10 zth

I'll ruminate some on how we can make the error clearer at least. As for the actual behavior of this being curried, I've got no good answer right now. Would have to dig in the code.

zth avatar Oct 13 '25 06:10 zth