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

GHC ghc-devs at haskell.org
Sat Jan 14 05:24:28 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 RyanGlScott):

 Well, there's certainly a technical issue in that quoting //any// function
 (not just pattern synonyms) will always add explicit quantification if it
 isn't present to begin with. For example:

 {{{
 λ> putStrLn $([d| id :: a -> a; id x = x |] >>= stringE . pprint)
 id_0 :: forall a_1 . a_1 -> a_1
 id_0 x_2 = x_2
 λ> putStrLn $([d| id :: a -> a; id x = x |] >>= stringE . show)
 [SigD id_6989586621679026833 (ForallT [PlainTV a_6989586621679026832] []
 (AppT (AppT ArrowT (VarT a_6989586621679026832)) (VarT
 a_6989586621679026832))),FunD id_6989586621679026833 [Clause [VarP
 x_6989586621679026834] (NormalB (VarE x_6989586621679026834)) []]]
 }}}

 Note how the `ForallT [PlainTV a_6989586621679026832] ...` gets added. So
 we'd need to be able to somehow preserve the fact that `id` was originally
 quoted without explicit quantification. We'd need to do this for functions
 and pattern synonyms for sure (and maybe other declarations that I'm not
 thinking of right now?).

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


More information about the ghc-tickets mailing list