[GHC] #16300: Make TH always reify data types with explicit return kinds

GHC ghc-devs at haskell.org
Mon Feb 11 21:03:30 UTC 2019


#16300: Make TH always reify data types with explicit return kinds
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:  (none)
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Template Haskell  |              Version:  8.6.3
      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:                    |
-------------------------------------+-------------------------------------

Comment (by RyanGlScott):

 Replying to [comment:4 goldfire]:
 > how about non-`Type`-kinded datatypes/newtypes always reify as GADTs?
 The choice of syntax in reification is immaterial, so let's just change
 it.

 I can see the appeal behind this choice, but at the same time, I would be
 a little sad if we went in this direction. Generally speaking, I like
 keeping TH reification as honest as possible. Moreover, whether a data
 type is declared as a GADT or not has some consequences on its other
 properties. For instance, the derived `Show` instance for a data type with
 infix constructors changes depending on whether the type is a GADT, and
 unless consumers have a reliable way to reify whether or not a data type
 is a GADT, they wouldn't be able to replicate what `deriving Show` does
 with Template Haskell, which would be a bit sad.

 I really wish that we had top-level kind signatures, since then we could
 just reify `type Foo :: TYPE IntRep`, regardless of whether `Foo` was
 defined using Haskell98 or GADT syntax. I suppose we could just park this
 ticket until that becomes a reality.

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


More information about the ghc-tickets mailing list