[GHC] #9226: Internal error when using equality constraint in pattern synonyms

GHC ghc-devs at haskell.org
Mon Jun 23 08:13:42 UTC 2014


#9226: Internal error when using equality constraint in pattern synonyms
-------------------------------------+-------------------------------------
        Reporter:  Iceland_jack      |            Owner:
            Type:  bug               |           Status:  new
        Priority:  lowest            |        Milestone:
       Component:  Compiler          |          Version:  7.8.2
      Resolution:                    |         Keywords:  renamer, pattern
Operating System:  Linux             |  synonyms, GADTs
 Type of failure:  GHC rejects       |     Architecture:  x86
  valid program                      |       Difficulty:  Unknown
       Test Case:                    |       Blocked By:
        Blocking:                    |  Related Tickets:
-------------------------------------+-------------------------------------
Changes (by simonpj):

 * cc: cactus (added)


Comment:

 You are absolutely right; there is a gaping hole in the pattern-synonym
 implementation.

 Gergo, the issue is this. When typechecking anything to do with GADTs, we
 need a type signature.  The [wiki:PatternSynonyms wiki page] describes
 signatures for pattern synonyms, but they are not implemented.  the
 `HsBinds.Sig` type has `PatSynSig`, but the parser does not recognise
 them, nor does the typechechecker do anything with them.  Notably, in
 `tcPatSynDecl` we'll need to implement different code to ''check'' that
 the synonym has a specified type than to ''infer'' the type it has.

 While fixing this, I found another crash.  This
 {{{
 pattern PUnit1 = (RUnit, ()) :: (Rep a, a)
 }}}
 crashes with
 {{{
 T9226.hs:15:38:
     GHC internal error: ‘a’ is not in scope during type checking, but it
 passed the renamer
 }}}
 Would you like to look at this Gergo?  I'm happy to help.

 Meanwhile, iceland_jack, I think you're stalled till we do this.  Thanks
 for reporting it.

 Simon

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


More information about the ghc-tickets mailing list