[GHC] #8968: Pattern synonyms and GADTs

GHC ghc-devs at haskell.org
Tue Apr 8 15:34:10 UTC 2014


#8968: Pattern synonyms and GADTs
----------------------------------------------+----------------------------
        Reporter:  kosmikus                   |            Owner:
            Type:  bug                        |           Status:  new
        Priority:  normal                     |        Milestone:
       Component:  Compiler (Type checker)    |          Version:
      Resolution:                             |  7.8.1-rc2
Operating System:  Unknown/Multiple           |         Keywords:
 Type of failure:  GHC rejects valid program  |     Architecture:
       Test Case:                             |  Unknown/Multiple
        Blocking:                             |       Difficulty:  Unknown
                                              |       Blocked By:
                                              |  Related Tickets:
----------------------------------------------+----------------------------

Comment (by kosmikus):

 Thanks. This is actually helping. However, it doesn't seem to work all the
 time.

 Consider this small variation of my program above:
 {{{
 {-# LANGUAGE GADTs, KindSignatures, PatternSynonyms, ScopedTypeVariables
 #-}

 data X :: (* -> *) -> * -> * where
   Y :: f a -> X f (Maybe a)

 -- pattern C :: a -> X Maybe (Maybe a)
 pattern C x = Y (Just x) :: X Maybe (Maybe a)
 }}}

 The `a` variable in the type signature cannot be quantified, because it's
 the type of `x`. I don't seem to be able to give a type signature to `x`
 on the LHS. The attempt
 as given above results in an internal error:
 {{{
 PatKind.hs:7:44:
     GHC internal error: ‘a’ is not in scope during type checking, but it
 passed the renamer
     tcl_env of environment: [(a5PN, Identifier[x::a, <NotTopLevel>])]
     In an expression type signature: X Maybe (Maybe a)
     In the expression: Y (Just x) :: X Maybe (Maybe a)
     In an equation for ‘$WC’: ($WC) x = Y (Just x) :: X Maybe (Maybe a)
 }}}

 Any further ideas?

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


More information about the ghc-tickets mailing list