| | 23 | TH will also need to support promoted constructors other than lists and tuples, but this is in fact already supported through the use of {{{ConT}}}. The namespace of defined types and of promoted types is already kept distinct. For example, if we have the definition {{{data Foo = Foo}}}, the results of {{{ [t| Foo |] }}} and {{{ [t| 'Foo |] }}} are distinct (as in, {{{==}}} returns {{{False}}}). However, applying {{{show}}} to these two results produces the same string. |
| | 25 | The one place TH needs to be updated to handle promoted data constructors is in the naming quote syntax. Currently, writing {{{'Foo}}} in an expression context within a splice looks {{{Foo}}} up in the expression namespace; TH will find a data constructor named {{{Foo}}} and return its {{{Name}}}. Writing {{{''Foo}}} in an expression context within a splice looks {{{Foo}}} up in the type namespace; TH will find a type constructor named {{{Foo}}} and return its name. There is currently no way to look up a promoted data constructor. The update will include a third form of quote, {{{'''Foo}}}, which gets the name of a promoted data constructor {{{Foo}}}. Though having three quotes is somewhat regrettable, it dovetails nicely with the fact that {{{'Foo}}}, when used in a type context, refers to a promoted data constructor. If we think of the first two quotes as establishing a type context, the third quote flows naturally. |