Smarter HsType pretty-print for promoted datacons

Authored by simonpj on Nov 15 2018, 3:02 AM.

Description

Smarter HsType pretty-print for promoted datacons

Fix Trac 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 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.

Details

Committed
simonpjNov 15 2018, 5:50 AM
Parents
rGHC0ce66be953be: Comments adding to the fix for Trac #15859
Branches
Unknown
Tags
Unknown