[GHC] #12503: Template Haskell regression: GHC erroneously thinks a type variable is also a kind

GHC ghc-devs at haskell.org
Sat Sep 10 21:20:38 UTC 2016


#12503: Template Haskell regression: GHC erroneously thinks a type variable is also
a kind
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:
            Type:  bug               |               Status:  new
        Priority:  high              |            Milestone:
       Component:  Template Haskell  |              Version:  8.0.1
      Resolution:                    |             Keywords:  TypeInType
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  GHC rejects       |  Unknown/Multiple
  valid program                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by RyanGlScott):

 As before, `Regression2` does in fact compile with GHC 7.10.3:

 {{{
 $ /opt/ghc/7.10.3/bin/ghc Regression2.hs
 [1 of 1] Compiling Regression2      ( Regression2.hs, Regression2.o )
 Regression2.hs:(15,3)-(27,15): Splicing declarations
     do { FamilyI (FamilyD _ tName_a39r _ _)
                  [DataInstD [] _ [tyVar_a39s] _ _] <- reify ''T;
          d_a3id <- instanceD
                      (cxt [])
                      (conT ''C `appT` (conT tName_a39r `appT` return
 tyVar_a39s))
                      [];
          return [d_a3id] }
   ======>
     instance C (T (b_apE :: k_apP))
 }}}

 There's something interesting to note here, as in GHC 8.0.1, it tries to
 splice:

 {{{#!hs
 instance C (T (b_avD :: b_avO))
 }}}

 But in GHC 7.10.3, it splices this:

 {{{#!hs
 instance C (T (b_apE :: k_apP))
 }}}

 Notice that the kind variable isn't `b` at all, but rather an inferred
 `k`! So it looks like there was a change in behavior at some point.

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


More information about the ghc-tickets mailing list