[GHC] #14343: bad pretty-printing of types with promoted data types

#14343: bad pretty-printing of types with promoted data types -------------------------------------+------------------------------------- Reporter: lspitzner | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- {{{
:set -XDataKinds :set -XPolyKinds data Proxy k = Proxy _ :: Proxy '[ 'True ] error: Found hole: _ :: Proxy '['True] _ :: Proxy '['True] error: Invalid type signature: _ :: ... Should be of form <variable> :: <type> }}}
Alternatively, this could be attributed to the parser/lexer doing an insufficient job there. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14343 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14343: bad pretty-printing of types with promoted data types -------------------------------------+------------------------------------- Reporter: lspitzner | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): Are you sure you put that in right? With GHC 8.2.1 I get {{{ Prelude> _ :: Proxy '[ 'True ] <interactive>:3:1: error: • Found hole: _ :: Proxy '['True] • In the expression: _ :: Proxy '[ 'True] In an equation for ‘it’: it = _ :: Proxy '[ 'True] • Relevant bindings include it :: Proxy '['True] (bound at <interactive>:3:1) }}} But if I miss out the space it parses `'['` as a character literal. {{{ Prelude> _ :: Proxy '['True ] <interactive>:4:1: error: Invalid type signature: _ :: ... Should be of form <variable> :: <type> }}} Hard to avoid that. Make sense? I'm inclined to say 'wont-fix'. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14343#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14343: bad pretty-printing of types with promoted data types -------------------------------------+------------------------------------- Reporter: lspitzner | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by lspitzner): I am fine with '[' being lexed as it is, so i don't mind a wont-fix for that aspect. But why does the error message for syntactically valid input contain source fragments that are not syntactically valid? Just as a test for how input is transformed (on 8.2.1 as well): {{{ Prelude> _ :: Proxy '[ 'True ] -- 2 spaces in input <interactive>:8:1: error: • Found hole: _ :: Proxy '['True] -- 0 spaces • In the expression: _ :: Proxy '[ 'True] -- 1 spaces In an equation for ‘it’: it = _ :: Proxy '[ 'True] -- 1 spaces • Relevant bindings include it :: Proxy '['True] (bound at <interactive>:8:1) -- 0 spaces }}} The zeros are problematic, and i think the ones only avoid the problem because they don't really re-layout, they just merge whitespace (at least that's what i suspect; haven't looked at the source). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14343#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14343: bad pretty-printing of types with promoted data types -------------------------------------+------------------------------------- Reporter: lspitzner | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * keywords: => newcomer Comment: This is just a deficiency of GHC's pretty-printer. It should be relatively straightforward to change it such that GHC inserts a space between `'[` and `'True`. See the [http://git.haskell.org/ghc.git/blob/6a9b9b431dcc94849d14c13639eb2f713e5aa1f4... pprIfaceTyList] function, which is responsible for pretty-printing promoted lists. Note that similar considerations also apply for promoted tuple constructors: {{{ λ> f :: Proxy _ -> Proxy '( 'True, 'True); f x = x <interactive>:5:12: error: • Found type wildcard ‘_’ standing for ‘'('True, 'True) :: (Bool, Bool)’ To use the inferred type, enable PartialTypeSignatures • In the type signature: f :: Proxy _ -> Proxy '( 'True, 'True) }}} So an analogous fix would be needed for the [http://git.haskell.org/ghc.git/blob/6a9b9b431dcc94849d14c13639eb2f713e5aa1f4... pprTuple] function. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14343#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14343: bad pretty-printing of types with promoted data types -------------------------------------+------------------------------------- Reporter: lspitzner | Owner: andreash Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by andreash): * owner: (none) => andreash Comment: I started working on this in https://phabricator.haskell.org/D4746. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14343#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14343: bad pretty-printing of types with promoted data types -------------------------------------+------------------------------------- Reporter: lspitzner | Owner: andreash Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4746 Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * differential: => Phab:D4746 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14343#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14343: bad pretty-printing of types with promoted data types -------------------------------------+------------------------------------- Reporter: lspitzner | Owner: andreash Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4746 Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: new => patch -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14343#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14343: bad pretty-printing of types with promoted data types
-------------------------------------+-------------------------------------
Reporter: lspitzner | Owner: andreash
Type: bug | Status: patch
Priority: normal | Milestone:
Component: Compiler | Version: 8.2.1
Resolution: | Keywords: newcomer
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): Phab:D4746
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ben Gamari
:set -XDataKinds :set -XPolyKinds data Proxy k = Proxy _ :: Proxy '[ 'True ] error: Found hole: _ :: Proxy '['True] _ :: Proxy '['True] error: Invalid type signature: _ :: ... Should be of form <variable> :: <type>
Test Plan: Validate with T14343
Reviewers: RyanGlScott, goldfire, bgamari, tdammers
Reviewed By: RyanGlScott, bgamari
Subscribers: tdammers, rwbarton, thomie, carter
GHC Trac Issues: #14343
Differential Revision: https://phabricator.haskell.org/D4746
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14343#comment:7>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

#14343: bad pretty-printing of types with promoted data types -------------------------------------+------------------------------------- Reporter: lspitzner | Owner: andreash Type: bug | Status: closed Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.2.1 Resolution: fixed | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4746 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: patch => closed * resolution: => fixed * milestone: => 8.6.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14343#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14343: bad pretty-printing of types with promoted data types
-------------------------------------+-------------------------------------
Reporter: lspitzner | Owner: andreash
Type: bug | Status: closed
Priority: normal | Milestone: 8.6.1
Component: Compiler | Version: 8.2.1
Resolution: fixed | Keywords: newcomer
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): Phab:D4746
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Simon Peyton Jones
participants (1)
-
GHC