[GHC] #12853: Unpromoted tuples in TH in correctly accepted by the type checker (was: Unpromoted tuples in TH in correctly accepted by tthe type checker)

GHC ghc-devs at haskell.org
Sat Nov 19 14:05:08 UTC 2016


#12853: Unpromoted tuples in TH in correctly accepted by the type checker
-------------------------------------+-------------------------------------
        Reporter:  erikd             |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.2.1
       Component:  Compiler (Type    |              Version:  8.1
  checker)                           |             Keywords:
      Resolution:                    |  TemplateHaskell
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  Other             |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by RyanGlScott):

 * keywords:   => TemplateHaskell
 * cc: RyanGlScott, goldfire (added)


Comment:

 I think there are two unrelated issues at play here. One is the issue that
 there's an inconsistency between tuples and other type constructors w.r.t.
 automatic promotion. Namely, most types get automatically promoted to a
 kind in certain contexts, whereas tuples do not. This is why `ty2`'s TH
 AST doesn't match that of `ty2'`.

 The other issue is that this program even typechecks at all. In light of
 the fact that tuples don't automatically get promoted to kinds, something
 like `[t| D (Bool, Bool) |]` feels bogus. But you can make it even more
 bogus if you wanted to:

 {{{#!hs
   ty2 <- [t| D (Char, Maybe)  |]
 }}}

 For better or worse, TH doesn't appear to kind-check its quoted types
 until they're spliced. Is this desirable? On hand, this allows you to pass
 around values in `Q` computations that don't necessarily type-check, which
 can be convenient. On the other hand, not sanity checking TH quotations
 leads to bizarre results like in the program above.

 I'm a bit reticent to say we should change the behavior with regards to
 the second issue, since I feel like it could be a very disruptive breaking
 change. I've cc'd goldfire to get his opinion on the matter.

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


More information about the ghc-tickets mailing list