[GHC] #9161: Pattern synonyms interact badly with data kinds

GHC ghc-devs at haskell.org
Thu Jun 19 10:50:45 UTC 2014


#9161: Pattern synonyms interact badly with data kinds
-------------------------------------+-------------------------------------
        Reporter:  Iceland_jack      |            Owner:  cactus
            Type:  bug               |           Status:  new
        Priority:  lowest            |        Milestone:
       Component:  Compiler (Type    |          Version:  7.8.2
  checker)                           |         Keywords:  renamer, pattern
      Resolution:                    |  synonyms, data kinds
Operating System:  Unknown/Multiple  |     Architecture:  Unknown/Multiple
 Type of failure:  Compile-time      |       Difficulty:  Unknown
  crash                              |       Blocked By:
       Test Case:                    |  Related Tickets:
        Blocking:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 Basically yes.  I suggest one of two things:

  * Add pattern synonyms as `AGlobal (AConLike (PatSynCon (panic "...")))`.
 Apart from the panic, this is exactly how ''imported'' pattern synonyms
 will appear, and `TcHsType.tcTyVar` will call `wrongThingErr` on it.  It
 would make sense for ''local'' pattern synonmys to behave the same way.
 The panic won't be looked at because `TcEnv.wrongThingErr` doesn't look at
 the payload.

  * Short cut: don't extend the environment. Instead, in the "no in scope
 during type checking" error, test for `DataName` and instead complain
 about using a pattern synonym in a type. Better: do this only in the
 context of `tcTyVar`, by replicating a certain amount of the `tcLookup`
 code. This is  bit of a hack; I'd rather not do it.

 Simon

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


More information about the ghc-tickets mailing list