[Git][ghc/ghc][wip/T23162-spj] Wibble Outputable

Simon Peyton Jones pushed to branch wip/T23162-spj at Glasgow Haskell Compiler / GHC Commits: 164590b5 by Simon Peyton Jones at 2025-08-16T00:09:40+01:00 Wibble Outputable - - - - - 1 changed file: - compiler/GHC/Utils/Outputable.hs Changes: ===================================== compiler/GHC/Utils/Outputable.hs ===================================== @@ -528,19 +528,22 @@ pprDeeperList f ds | null ds = f [] | otherwise = SDoc work where - work ctx@SDC{ sdocStyle=PprUser _ (PartWay {}) _ } - = let -- Only do this depth-limitation in User style - -- when PartWay is on. Why not for DefaultDepth? - -- I have no idea; seems like a bug to me. - go _ [] = [] - go i (d:ds) | i >= default_depth = [text "...."] - | otherwise = d : go (i+1) ds - in runSDoc (f (go 0 ds)) ctx - where - default_depth = sdocDefaultDepth ctx + -- Trim the list to the length of the remaining depth count + work ctx@SDC{ sdocStyle=PprUser _ depth _ } + | Just list_elts_to_print + <- case depth of + DefaultDepth -> Just (sdocDefaultDepth ctx) + PartWay n -> Just n + AllTheWay -> Nothing + = runSDoc (f (trim list_elts_to_print ds)) ctx work other_ctx = runSDoc (f ds) other_ctx +trim :: Int -> [SDoc] -> [SDoc] +trim _ [] = [] +trim 0 _ = [text "...."] +trim n (d:ds) = d : trim (n-1) ds + pprSetDepth :: Depth -> SDoc -> SDoc pprSetDepth depth doc = SDoc $ \ctx -> case ctx of View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/164590b57b9bd0ff7f18bb0bef2ed539... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/164590b57b9bd0ff7f18bb0bef2ed539... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Simon Peyton Jones (@simonpj)