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

GHC ghc-devs at haskell.org
Thu Jan 12 10:54:16 UTC 2017


#13018: TH-spliced pattern synonym declaration fails to typecheck
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       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):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 > Agreed that the splitting rule must be implemented in the TH quoting
 mechanism.

 I do not agree.

 The business of TH is to reflect Haskell ''source'' code.  In this case
 the Haskell source code signature is
 {{{
 pattern P :: b -> T a
 }}}
 That generates a `LHsSigType` for the type. '''We should be able to round-
 trip that `LHsSigType` through TH and get back the exact same thing'''.
 If we do that then, because it's the exact same thing, if it typechecked
 before it'll typecheck after the round trip.

 What is happening, I think, is that we are getting back a `LHsSigType`
 with more explicit quantification that the original one had.  That's bad!
 We should get back the exact same thing.

 I haven't dug deeper, but that must be possible, right?

 I think it's the ''wrong'' thing for the TH (syntax-level) conversions to
 attempt to figure out what is quantified where. Just reproduce what the
 user wrote!

 Simon

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


More information about the ghc-tickets mailing list