@@ -13,6 +13,7 @@ module Ormolu.Printer.Meat.Common
1313 )
1414where
1515
16+import Data.List (isPrefixOf)
1617import GHC hiding (GhcPs, IE)
1718import Module (Module (..))
1819import Name (nameStableString)
@@ -68,7 +69,9 @@ p_rdrName l@(L spn _) = located l $ \x -> do
6869 -- NOTE I'm not sure this "stable string" is stable enough, but
6970 -- it looks like this is the most robust way to tell if we're
7071 -- looking at exactly this piece of built-in syntax.
71− (atom name, nameStableString name `elem` avoidParensStableNames)
72+ ( atom name
73+ , "$ghc-prim$GHC.Tuple$" `isPrefixOf` nameStableString name
74+ )
7275 if avoidParens
7376 then m
7477 else parensWrapper (backticksWrapper m)
@@ -83,13 +86,3 @@ p_ieWildcard :: IEWildcard -> R ()
8386p_ieWildcard = \case
8487 NoIEWildcard -> return ()
8588 IEWildcard n -> parens (atom n)
86−
87−avoidParensStableNames :: [String]
88−avoidParensStableNames =
89− [ "$ghc-prim$GHC.Tuple$()"
90− , "$ghc-prim$GHC.Tuple$(,)"
91− , "$ghc-prim$GHC.Tuple$(,,)"
92− , "$ghc-prim$GHC.Tuple$(,,,)"
93− , "$ghc-prim$GHC.Tuple$(,,,,)"
94− , "$ghc-prim$GHC.Tuple$(,,,,,)"
95− ]