]> Repositorios git - classgraph.git/commitdiff
Show only constructor names in data fam-instance node labels
authorJavier Sagredo <[email protected]>
Thu, 7 May 2026 00:39:04 +0000 (02:39 +0200)
committerJavier Sagredo <[email protected]>
Thu, 7 May 2026 00:39:04 +0000 (02:39 +0200)
Node labels for data fam-instances now read `Family args = ConA |
ConB` instead of `Family args = ConA Int Bool | ConB { x :: Char }`.
Fields just pad the node visually and are rarely interesting at a
glance. The side panel still renders the full constructor
declaration (name + arg types or record fields) for when the detail
is wanted.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
data/viewer.js

index 0f81a654b8dd17f35e605626bbb718c1f89dd946..5cc7e36273ec3492b12067af5ec42c228ee49c80 100644 (file)
     const args = renderArgsCompact(fi.fiArgs, fi.fiTyVars);
     const head = fi.fiFamily.qnName + (args ? ' ' + args : '');
     if (fi.fiIsData) {
-      // Show the user-declared data constructors on the right-hand
-      // side, using `|` between alternatives. Empty fiDataCons (older
-      // dumps, or extraction edge cases) just degrade to the bare
-      // head with no `=`.
+      // Node label: just the constructor name(s), not the fields.
+      // Fields tend to be uninteresting at-a-glance and pad the
+      // node visually; the side panel still shows the full
+      // declaration for users who want the detail.
       const dcs = fi.fiDataCons || [];
       if (dcs.length === 0) return head;
-      const cons = dcs.map(dc => renderDataCon(dc, fi.fiTyVars)).join(' | ');
+      const cons = dcs.map(dc => dc.dcName || '?').join(' | ');
       return head + ' = ' + cons;
     }
     return head + ' = ' + renderArg(fi.fiRhs, fi.fiTyVars);