rescript-lang / rescript-lang/rescript

[bug?] functors are not uncurried

Open
#7,942 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
OCaml
Stars
7.5k
Forks
485
Avg merge
1d 2h
Merged PRs (30d)
55

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is named. Reproduce the shown two-argument functor example, then trace the compiler's handling of the partial application and reported error location; done means the missing-argument error appears at the functor application rather than only at C.whatever().

Written by the indexing model from the issue text.

Assessment

Tech stack
ocaml
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.