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

GHC ghc-devs at haskell.org
Thu Nov 15 11:53:20 UTC 2018


#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 <simonpj@…>):

 In [changeset:"ae2c9b40f5b6bf272251d1f4107c60003f541b62/ghc"
 ae2c9b40/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="ae2c9b40f5b6bf272251d1f4107c60003f541b62"
 Smarter HsType pretty-print for promoted datacons

 Fix Trac #15898, by being smarter about when to print
 a space before a promoted data constructor, in a HsType.
 I had to implement a mildly tiresome function
     HsType.lhsTypeHasLeadingPromotionQuote
 It has multiple cases, of course, but it's very simple.

 The patch improves the error-message output in a bunch of
 cases, and (to my surprise) actually fixes a bug in the
 output of T14343 (Trac #14343), thus

   -  In the expression: _ :: Proxy '('( 'True,  'False),  'False)
   +  In the expression: _ :: Proxy '( '( 'True, 'False), 'False)

 I discovered that there were two copies of the PromotionFlag
 type (a boolean, with helpfully named data cons), one in
 IfaceType and one in HsType.  So I combined into one,
 PromotionFlag, and moved it to BasicTypes.  That's why
 quite a few files are touched, but it's all routine.
 }}}

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14343#comment:9>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list