[GHC] #10945: Typed Template Haskell splices broken in HEAD (7.11)

GHC ghc-devs at haskell.org
Tue Oct 20 11:28:24 UTC 2015


#10945: Typed Template Haskell splices broken in HEAD (7.11)
-------------------------------------+-------------------------------------
        Reporter:  jstolarek         |                Owner:  jstolarek
            Type:  bug               |               Status:  new
        Priority:  high              |            Milestone:  8.0.1
       Component:  Template Haskell  |              Version:  7.11
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:  th/T10945
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by jstolarek):

 I initially thought that this bogus code - ie. top-level typed TH splice -
 should be rejected as a parse error. I spent some time trying to change
 the parser to reject the code but I couldn't find a good way of doing
 that. Then I realized that this code should parse: with TH enabled all
 top-level expressions should really be accepted, including a typed TH
 splice.  After some more thought I believe that the right way of doing
 this would be to run the typed TH splice and then report a type error in
 the same way we report a type error here:

 {{{#!hs
 {-# LANGUAGE TemplateHaskell #-}

 module T10945s where

 import Language.Haskell.TH

 True
 }}}
 {{{
 T10945.hs:8:1:
     Couldn't match type ‘Bool’ with ‘Q [Dec]’
     Expected type: DecsQ
       Actual type: Bool
     In the expression: True
 }}}
 Before investing more time into this I'd like to hear thoughts from other
 devs.

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


More information about the ghc-tickets mailing list