[GHC] #13018: TH-spliced pattern synonym declaration fails to typecheck

GHC ghc-devs at haskell.org
Mon Jan 23 14:16:50 UTC 2017


#13018: TH-spliced pattern synonym declaration fails to typecheck
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:
            Type:  bug               |               Status:  patch
        Priority:  normal            |            Milestone:  8.2.1
       Component:  Compiler (Type    |              Version:  8.0.1
  checker)                           |             Keywords:
      Resolution:                    |  PatternSynonyms
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  GHC rejects       |  Unknown/Multiple
  valid program                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D2974
       Wiki Page:                    |
-------------------------------------+-------------------------------------

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

 In [changeset:"729a5e452db530e8da8ca163fcd842faac6bd690/ghc"
 729a5e45/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="729a5e452db530e8da8ca163fcd842faac6bd690"
 Don't quantify implicit type variables when quoting type signatures in TH

 Summary:
 A bug was introduced in GHC 8.0 in which Template Haskell-quoted type
 signatures would quantify _all_ their type variables, even the implicit
 ones.
 This would cause splices like this:

 ```
 $([d| idProxy :: forall proxy (a :: k). proxy a -> proxy a
       idProxy x = x
    |])
 ```

 To splice back in something that was slightly different:

 ```
 idProxy :: forall k proxy (a :: k). proxy a -> proxy a
 idProxy x = x
 ```

 Notice that the kind variable `k` is now explicitly quantified! What's
 worse,
 this now requires the `TypeInType` extension to be enabled.

 This changes the behavior of Template Haskell quoting to never explicitly
 quantify type variables which are implicitly quantified in the source.

 There are some other places where this behavior pops up too, including
 class methods, type ascriptions, `SPECIALIZE` pragmas, foreign imports,
 and pattern synonynms (#13018), so I fixed those too.

 Fixes #13018 and #13123.

 Test Plan: ./validate

 Reviewers: simonpj, goldfire, austin, bgamari

 Reviewed By: simonpj, goldfire

 Subscribers: simonpj, mpickering, thomie

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

 GHC Trac Issues: #13018, #13123
 }}}

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


More information about the ghc-tickets mailing list