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

GHC ghc-devs at haskell.org
Wed Dec 21 17:02:40 UTC 2016


#13018: TH-spliced pattern synonym declaration fails to typecheck
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Template Haskell  |              Version:  8.1
      Resolution:                    |             Keywords:
                                     |  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):

 The quoting mechanism doesn't appear to be at fault here, since you can
 trigger the same bug using only `Language.Haskell.TH`:

 {{{#!hs
 {-# LANGUAGE GADTs #-}
 {-# LANGUAGE PatternSynonyms #-}
 {-# LANGUAGE TemplateHaskell #-}
 module Bug where

 import Language.Haskell.TH

 data T a where
   MkT :: Eq b => b -> T a

 $(do pName <- newName "P"
      aName <- newName "a"
      bName <- newName "b"
      xName <- newName "x"
      return [ PatSynSigD pName (ForallT [PlainTV bName,PlainTV aName] []
 (ForallT [] [] (AppT (AppT ArrowT (VarT bName)) (AppT (ConT ''T) (VarT
 aName)))))
             , PatSynD pName (PrefixPatSyn [xName]) Unidir (ConP 'MkT [VarP
 xName])
             ]
  )
 }}}

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


More information about the ghc-tickets mailing list