[GHC] #13123: Regression: TH splice requires TypeInType when it shouldn't

GHC ghc-devs at haskell.org
Tue Jan 24 15:31:50 UTC 2017


#13123: Regression: TH splice requires TypeInType when it shouldn't
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:
            Type:  bug               |               Status:  closed
        Priority:  normal            |            Milestone:  8.2.1
       Component:  Template Haskell  |              Version:  8.0.1
      Resolution:  fixed             |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  GHC rejects       |  Unknown/Multiple
  valid program                      |            Test Case:  th/T13123
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D2974,
       Wiki Page:                    |  Phab:3002
-------------------------------------+-------------------------------------

Comment (by Ryan Scott <ryan.gl.scott@…>):

 In [changeset:"9fd87ef8a16fbbce35205ae63d75d239bb575ccc/ghc" 9fd87ef/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="9fd87ef8a16fbbce35205ae63d75d239bb575ccc"
 Don't put foralls in front of TH-spliced GADT constructors that don't need
 them

 Summary:
 It turns out that D2974 broke this program
 (see https://phabricator.haskell.org/rGHC729a5e452db5#58801):

 ```lang=haskell
 {-# LANGUAGE ConstraintKinds #-}
 {-# LANGUAGE GADTs #-}
 {-# LANGUAGE KindSignatures #-}
 {-# LANGUAGE TemplateHaskell #-}
 {-# OPTIONS_GHC -ddump-splices #-}
 module Bug where

 import GHC.Exts (Constraint)

 $([d| data Dec13 :: (* -> Constraint) -> * where
         MkDec13 :: c a => a -> Dec13 c
     |])
 ```

 This was actually due to a long-standing bug in `hsSyn/Convert` that put
 unnecessary `forall`s in front of GADT constructors that didn't have any
 explicitly quantified type variables.

 This cargo-cults the code in `Convert` that handles `ForallT` and adapts
 it to `ForallC`. Fixes #13123 (for real this time).

 Test Plan: make test TEST=T13123

 Reviewers: goldfire, austin, bgamari

 Reviewed By: bgamari

 Subscribers: thomie

 Differential Revision: https://phabricator.haskell.org/D3002

 GHC Trac Issues: #13123
 }}}

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


More information about the ghc-tickets mailing list