rescript-lang / rescript-lang/rescript-vscode
Module type and intellisense looks weird after functor
Nobody has claimed this yet.
- Dominant language
- ReScript
- Stars
- 354
- Forks
- 63
- Avg merge
- 11h 29m
- Merged PRs (30d)
- 1
Description
I’m using functors to generate validated primitive types, like a NonNegativeInt. It works. But the tooltip/intellisense for using the functor is kind of strange. For example, in the code below when I try to use my NonNegativeInt method here is what I see…

What I want to see is int instead of C.domain. At this point, what is module C? If I want all traces of C.domain to be replaced with int I think I need to do the BetterNonNegativeInt casting/assignment below, which is an extra step. Is there some way to do all this in a single step? Is this a problem with the VS Code extension?
module type T = {
type t
type domain
let eq: (t, t) => bool
let make: domain => option<t>
let value: t => domain
}
module type Configuration = {
type domain
let cmp: (domain, domain) => float
let validate: domain => option<domain>
}
module Make = (C: Configuration): (T with type domain := C.domain) => {
type t = C.domain
type domain = C.domain
let eq = (i: t, j: t) => C.cmp(i, j) === 0.0
let value = i => i
let make = (i: domain) => C.validate(i)
}
module NonNegativeInt = Make({
type domain = int
let cmp = (x, y) => x < y ? -1.0 : x > y ? 1.0 : 0.0
let validate = i => i >= 0 ? Some(i) : None
})
module BetterNonNegativeInt: T with type domain := int = NonNegativeInt
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the tooltip and IntelliSense behavior in the VS Code extension using the provided functor example. Trace whether the displayed C.domain type comes from the extension or its language-server integration, then verify that the relevant tooltip presents the resolved int type without requiring the BetterNonNegativeInt assignment.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- vscode
- Domain
- developer-experience
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100