[GHC] #8968: Pattern synonyms and GADTs

GHC ghc-devs at haskell.org
Thu Apr 10 20:21:48 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 simonpj):

 The above discussion sheds light on the "not in scope" error.  Of course,
 it's a GHC panic, so it's not right. But that's because there really is a
 problem.
  * As a pattern `Y (Just x) :: X Maybe a`
  * As a expression `Y (Just x) :: X Maybe Int`, and requires `x::Int`.

 So it's not clear that a single signature for the two ways of looking at
 the RHS makes sense at all!  It look as though we need one for its use as
 a pattern and one for its use as an expression.  Sigh.

 Mind you, the "type as an expression" is easily inferred, as you mention.
 So perhaps the pattern signature (once we have them) can be taken as
 applying only to the pattern, not the expression?

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


More information about the ghc-tickets mailing list