Skip to content
  • Simon Peyton Jones's avatar
    Smarter HsType pretty-print for promoted datacons · ae2c9b40
    Simon Peyton Jones authored
    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.
    ae2c9b40