]> Repositorios git - classgraph.git/commitdiff
Render multi-arg superclass edge labels as {a} {b}, not (a, b)
authorJavier Sagredo <[email protected]>
Thu, 7 May 2026 00:51:19 +0000 (02:51 +0200)
committerJavier Sagredo <[email protected]>
Thu, 7 May 2026 00:51:19 +0000 (02:51 +0200)
The tuple-shaped label `(a, b)` looked like the Haskell tuple type
`(a, b)`, but it's actually a positional list of args being passed
to the superclass — not packed into a pair. Switch to space-
separated brace-wrapped form `{a} {b}` so the positional shape
reads at a glance. Single-arg labels stay bare since there's no
ambiguity.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
src/Classgraph/Render.hs

index 3bc52cc3b61311db2fecdbbe07144500250a8608..67d283b4f987e9658625c7976a8b40bdb86a6eb3 100644 (file)
@@ -301,16 +301,21 @@ flavorTag DataFam       = "data"
 
 -- | Render the multi-param positional mapping carried by a 'SuperclassEdge'.
 --
+-- Multi-arg labels use @{arg1} {arg2}@ rather than @(arg1, arg2)@ —
+-- the tuple shape was confusingly close to Haskell's @(a, b)@ tuple
+-- type, but the args are positional, not packed.
+--
 -- Examples:
 --
 --   * Single-arg: subclass @C a@, superclass @D a@ ⇒ label @"a"@.
---   * Multi-param identity: subclass @C a b@, super @D a b@ ⇒ @"(a, b)"@.
+--   * Multi-param identity: subclass @C a b@, super @D a b@ ⇒ @"{a} {b}"@.
 --   * Multi-param projection: subclass @C a b@, super @D b@ ⇒ @"b"@.
 --   * Family-mediated:        subclass @C a@, super @D (F a)@ ⇒ @"(F a)"@.
 edgeLabel :: [TyVarInfo] -> SuperclassEdge -> Text
 edgeLabel subTvs se = case seArgs se of
   [arg]  -> renderTypeArgShort subTvs arg
-  args   -> "(" <> T.intercalate ", " (map (renderTypeArgShort subTvs) args) <> ")"
+  args   -> T.intercalate " "
+              (map (\a -> "{" <> renderTypeArgShort subTvs a <> "}") args)
 
 renderTypeArgShort :: [TyVarInfo] -> TypeArg -> Text
 renderTypeArgShort subTvs ta = case ta of