[GHC] #15941: Pretty-printing of invisible arguments to (->)
#15941: Pretty-printing of invisible arguments to (->) -------------------------------------+------------------------------------- Reporter: monoidal | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.6.3 Component: Compiler | Version: 8.6.2 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: -------------------------------------+------------------------------------- The invisible arguments to `(->)` are currently printed as: {{{ λ> :set -XKindSignatures -fprint-explicit-runtime-reps -fprint-explicit- kinds λ> type T = ((->) :: * -> * -> *) λ> :i T type T = @{'GHC.Types.LiftedRep} -> @{'GHC.Types.LiftedRep} :: * -> * -> * }}} I'd expect {{{ type T = (->) @{'GHC.Types.LiftedRep} @{'GHC.Types.LiftedRep} :: * -> * -> * }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15941> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#15941: Pretty-printing of invisible arguments to (->) -------------------------------------+------------------------------------- Reporter: monoidal | Owner: RyanGlScott Type: bug | Status: new Priority: normal | Milestone: 8.8.1 Component: Compiler | Version: 8.7 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: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * owner: (none) => RyanGlScott * version: 8.6.2 => 8.7 * milestone: 8.6.3 => 8.8.1 Comment: Oops! This one is almost guaranteed to be my fault. I'll take a look. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15941#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#15941: Pretty-printing of invisible arguments to (->) -------------------------------------+------------------------------------- Reporter: monoidal | Owner: RyanGlScott Type: bug | Status: new Priority: normal | Milestone: 8.8.1 Component: Compiler | Version: 8.6.2 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: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * version: 8.7 => 8.6.2 Comment: I set the version of this ticket to 8.7, mistakenly thinking that this was a regression introduced in commit f5d2083807a03c57f194fcc3a7baf82e34aad524. But as it turns out, this bug has been lurking even before that! In GHC 8.6.2, you get this: {{{
:i T type T = 'GHC.Types.LiftedRep -> 'GHC.Types.LiftedRep :: * -> * -> * -- Defined at <interactive>:3:1 }}}
Another observation: this is not unique to `(->)` (which is what I originally thought, since there are many special cases for function arrows throughout the codebase). Any infix type constructor with two invisible arguments will do, as the following GHCi session shows: {{{
import GHC.Generics type T2 = (:.:) :i T2 type T2 = * :.: * :: (* -> *) -> (* -> *) -> * -> * -- Defined at <interactive>:11:1 }}}
-- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15941#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#15941: Pretty-printing of invisible arguments to (->) -------------------------------------+------------------------------------- Reporter: monoidal | Owner: RyanGlScott Type: bug | Status: patch Priority: normal | Milestone: 8.8.1 Component: Compiler | Version: 8.6.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D5375 Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: new => patch * differential: => Phab:D5375 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15941#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#15941: Pretty-printing of invisible arguments to (->) -------------------------------------+------------------------------------- Reporter: monoidal | Owner: RyanGlScott Type: bug | Status: patch Priority: normal | Milestone: 8.8.1 Component: Compiler | Version: 8.6.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D5375 Wiki Page: | -------------------------------------+------------------------------------- Comment (by Ryan Scott <ryan.gl.scott@…>): In [changeset:"984b75de7082689ebcc6e9d17b37f2c9b3702f71/ghc" 984b75de/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="984b75de7082689ebcc6e9d17b37f2c9b3702f71" Fix #15941 by only special-casing visible infix applications Summary: The iface pretty-printer had a special case for an application of an infix type constructor to two arguments. But this didn't take the visibilities of the arguments into account, which could lead to strange output like `@{LiftedRep} -> @{LiftedRep}` when `-fprint-explicit-kinds` was enabled (#15941). The fix is relatively straightforward: simply plumb through the visibilities of each argument, and only trigger the special case for infix applications if both arguments are visible (i.e., required). Test Plan: make test TEST=T15941 Reviewers: goldfire, bgamari, monoidal Reviewed By: goldfire, monoidal Subscribers: simonpj, rwbarton, carter GHC Trac Issues: #15941 Differential Revision: https://phabricator.haskell.org/D5375 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15941#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#15941: Pretty-printing of invisible arguments to (->) -------------------------------------+------------------------------------- Reporter: monoidal | Owner: RyanGlScott Type: bug | Status: closed Priority: normal | Milestone: 8.8.1 Component: Compiler | Version: 8.6.2 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | ghci/scripts/T15941 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D5375 Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: patch => closed * testcase: => ghci/scripts/T15941 * resolution: => fixed -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15941#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC