[GHC] #14843: Can't splice a partially applied PromoteTupleT type from Template Haskell

GHC ghc-devs at haskell.org
Fri Feb 23 04:09:15 UTC 2018


#14843: Can't splice a partially applied PromoteTupleT type from Template Haskell
-------------------------------------+-------------------------------------
           Reporter:  RyanGlScott    |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Template       |           Version:  8.2.2
  Haskell                            |
           Keywords:                 |  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:
-------------------------------------+-------------------------------------
 {{{#!hs
 {-# LANGUAGE DataKinds #-}
 {-# LANGUAGE TemplateHaskell #-}
 module Bug where

 import Language.Haskell.TH.Syntax

 type T1 = $(return (PromotedTupleT 2))
 type T2 = $([t| '(,) |])
 type T3 = $(return (PromotedT (tupleDataName 2)))
 }}}

 The splices for `T2` and `T3` both work. However, the splice for `T1`
 causes Template Haskell to have a conniption:

 {{{
 $ /opt/ghc/8.2.2/bin/ghci Bug.hs
 GHCi, version 8.2.2: http://www.haskell.org/ghc/  :? for help
 Loaded GHCi configuration from /home/rgscott/.ghci
 [1 of 1] Compiling Bug              ( Bug.hs, interpreted )

 Bug.hs:7:13: error:
     • Malformed type PromotedTupleT 2
       When splicing a TH type: '(,)
     • In the untyped splice: $(return (PromotedTupleT 2))
   |
 7 | type T1 = $(return (PromotedTupleT 2))
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^
 }}}

 Patch incoming.

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


More information about the ghc-tickets mailing list