[GHC] #11484: Type synonym using -XTypeInType can't be spliced with TH

GHC ghc-devs at haskell.org
Mon Apr 4 22:32:02 UTC 2016


#11484: Type synonym using -XTypeInType can't be spliced with TH
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Template Haskell  |              Version:  8.0.1-rc1
      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):

 I did some cursory debugging on this by pretty printing the `TyCon` and
 its `TyVar`s when
 [http://git.haskell.org/ghc.git/blob/7407a66d5bd29aa011f5a4228c6e2b2f7f8ad3f8:/compiler/typecheck/TcTyClsDecls.hs#l2163
 checkValidTyConVars] (the function which is producing that error message)
 is run.

 When you type in that type synonym directly, i.e.,

 {{{
 λ> type TySyn2 (k :: *) (a :: k) = ()
 RGS
   TySyn2
   [k_a5hY, a_a5hZ]
 }}}

 then the only type variables are `k` and `a`, as expected. But when it's
 spliced in from TH:

 {{{
 λ> data X; $([d| type TySyn2 (k :: *) (a :: k) = () |])
 ...
 <interactive>:3:11-51: Splicing declarations
     [d| type TySyn2_a1ba (k_a1bb :: *) (a_a1bc :: k_a1bb) = () |]
   ======>
     type TySyn2_a5hT (k_a5hU :: Type) (a_a5hV :: k_a5hU) = ()
 RGS
   TySyn2
   [k_a5hU[sk], k_a5hU, a_a5hV]
 }}}

 we can see how it went wrong, as GHC mistakenly believes that there are
 type variables. I suppose we just have to "un-skolemize" one of the
 occurrences of `k`... is there a function which does this?

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


More information about the ghc-tickets mailing list