[GHC] #8403: Pretty-printing of long types

#8403: Pretty-printing of long types ------------------------------------+------------------------------------- Reporter: monoidal | Owner: Type: bug | Status: new Priority: lowest | Milestone: Component: Compiler | Version: 7.6.3 Keywords: | Operating System: Unknown/Multiple Architecture: Unknown/Multiple | Type of failure: Other Difficulty: Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | ------------------------------------+------------------------------------- Low priority, but this ghci output could be more packed. {{{ λ> :t (,,,,,,,,,,,,,,,,,,,,,,,) (,,,,,,,,,,,,,,,,,,,,,,,) :: a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s -> t -> u -> v -> w -> x -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8403 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8403: Pretty-printing of long types -------------------------------------+------------------------------------- Reporter: monoidal | Owner: Type: bug | Status: new Priority: lowest | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: Other | Blocked By: Test Case: | Related Tickets: #9428 Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by thomie): * related: => #9428 Comment: Thank you for the report. #9428 looks like another instance of this bug, but then for error messages. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8403#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8403: Pretty-printing of long types -------------------------------------+------------------------------------- Reporter: monoidal | Owner: Type: bug | Status: new Priority: lowest | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: Type of failure: Other | Unknown/Multiple Blocked By: | Test Case: Related Tickets: #9428 | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by thomie): * keywords: => newcomer Comment: Might not be easy, but I think a fix is to be found in this single file: `compiler/utils/Pretty.hs`. For historical reasons, there's also a copy in `libraries/pretty`. See https://github.com/haskell/pretty/issues/1. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8403#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8403: Pretty-printing of long types -------------------------------------+------------------------------------- Reporter: monoidal | Owner: Type: bug | Status: new Priority: lowest | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: Type of failure: Other | Unknown/Multiple Blocked By: | Test Case: Related Tickets: #9428 | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by phadej): With the test program: {{{ import Text.PrettyPrint -- mocking how compiler/types/TypeRep.hs would print the type pairUntil :: Char -> Doc pairUntil c = pprArrowChain (varDocs ++ [resultPair]) where varDocs = map char ['a'..c] resultPair = parens (sep (punctuate comma varDocs)) arrow :: Doc arrow = text "->" pprArrowChain :: [Doc] -> Doc -- pprArrowChain [a,b,c] generates a -> b -> c pprArrowChain [] = empty pprArrowChain (arg:args) = sep [arg, sep (map (arrow <+>) args)] }}} {{{ λ> Test.pairUntil 'd' a -> b -> c -> d -> (a, b, c, d) λ> Test.pairUntil 'k' a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> (a, b, c, d, e, f, g, h, i, j, k) }}} I have no good ideas how to define "more packed", yet so output is still understandable. E.g. will this "less area" method work for all types: {{{ a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o -> p -> q -> r -> s -> t -> u -> v -> w -> x -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) }}} My gut feelings that the layout algorithm won't be linear anymore, don't know if that is the problem though. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8403#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8403: Pretty-printing of long types -------------------------------------+------------------------------------- Reporter: monoidal | Owner: Type: bug | Status: new Priority: lowest | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: Type of failure: Other | Unknown/Multiple Blocked By: | Test Case: Related Tickets: #9428 | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by joehillen): [https://gist.github.com/joehillen/bc115c8e5d6a7587777c Just to be clear.] What exactly is the problem with the current formatting? It seems to make perfect sense and is reasonable to break at every '->' or ','. To me, the current behavior is more readable than the proposed alternative. Even if it does take up more vertical space. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8403#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8403: Pretty-printing of long types -------------------------------------+------------------------------------- Reporter: monoidal | Owner: Type: bug | Status: new Priority: lowest | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Other | Unknown/Multiple Blocked By: | Test Case: Related Tickets: #9428 | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by thomie): * keywords: newcomer => Comment: Yeah, maybe just leave it the way it is. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8403#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8403: Pretty-printing of long types -------------------------------------+------------------------------------- Reporter: monoidal | Owner: Type: bug | Status: closed Priority: lowest | Milestone: Component: Compiler | Version: 7.6.3 Resolution: wontfix | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: #9428 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by thomie): * status: new => closed * resolution: => wontfix Comment: See comment:4. Please reopen if you //really// want this. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8403#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC