From b9b981bd4f7eef441dbd1e568406f16d51987c98 Mon Sep 17 00:00:00 2001 From: Javier Sagredo Date: Thu, 7 May 2026 02:43:54 +0200 Subject: [PATCH] Show constructor names in family-view data fam-instance rows too The family view (drilling into a family directly) had its own fam-instance label code path that bypassed renderFamInstHead, so data fam-instance rows showed only their args (no constructor names). Mirror the renderFamInstHead behaviour: append `= ConA | ConB` for data fam-instances. The family name itself stays implicit (it's already at the top of the family view). Co-Authored-By: Claude Opus 4.7 (1M context) --- data/viewer.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/data/viewer.js b/data/viewer.js index 5cc7e36..362c98c 100644 --- a/data/viewer.js +++ b/data/viewer.js @@ -1095,9 +1095,20 @@ const fiNodeId = 'faminst:' + fi._idx; seenNodes.add(fiNodeId); const args = renderArgsCompact(fi.fiArgs, fi.fiTyVars); - const label = fi.fiIsData - ? (args || '') - : args + ' = ' + renderArg(fi.fiRhs, fi.fiTyVars); + const lhs = args || ''; + let label; + if (fi.fiIsData) { + // In the family view the family name is already shown at the + // top of the graph, so each row only needs `args = Cons`. We + // *do* want the constructor names here, the same way the + // instance view's renderFamInstHead does — just don't repeat + // the family name. + const dcs = fi.fiDataCons || []; + const cons = dcs.map(dc => dc.dcName || '?').join(' | '); + label = cons ? lhs + ' = ' + cons : lhs; + } else { + label = lhs + ' = ' + renderArg(fi.fiRhs, fi.fiTyVars); + } els.push({ group: 'nodes', data: { id: fiNodeId, label, -- 2.54.0