Semantic Diff

#9083 Show a functor's parameters on hover

1 commit

c989f879dfc8593af2b46d33752286f71c850e0d..pr-9083

aac2e68c5 · cknitt + Claude · Oct 27, 2026, 12:54 UTC

Show a functor's parameters on hover

Why

Editor analysis models a functor by the structure of its result, so hover on a functor showed its body as if it were a plain module, and nothing said it takes arguments. The result structure now records the parameters, and hover prints them in front of the body.

modifiedDiagnostic hover on a functor

module type Ord = {  type t  let compare: (t, t) => int}module MakeSet = (O: Ord) => {  type t = array<O.t>  let add = (s: t, x: O.t) => s->Array.concat([x])}
rescript
Before tests/analysis_tests/tests/src/HoverFunctor.res
After tests/analysis_tests/tests/src/HoverFunctor.res
module MakeSet: {module MakeSet: (O: Ord) => { type t = array<O.t> type t = array<O.t> let add: (t, O.t) => array<O.t> let add: (t, O.t) => array<O.t>}}

Review

  • Why not add a functor case to the analysis module type? Completion, references and path resolution all treat a functor as its result and would each need the new case; only hover displays the parameters, so they are recorded on the result structure.
  • What does hover show for an applied functor? A plain module: an application is modelled by its signature, so module IntSet = MakeSet(IntOrd) shows no parameters, and a partial application such as Pair(IntOrd) shows only the remaining one.