[GHC] #8128: Standalone deriving fails for GADTs due to inaccessible code

GHC ghc-devs at haskell.org
Fri Aug 16 10:04:57 CEST 2013


#8128: Standalone deriving fails for GADTs due to inaccessible code
----------------------------------------------+----------------------------
        Reporter:  adamgundry                 |            Owner:
            Type:  bug                        |           Status:  new
        Priority:  normal                     |        Milestone:
       Component:  Compiler (Type checker)    |          Version:  7.7
      Resolution:                             |         Keywords:
Operating System:  Unknown/Multiple           |     Architecture:
 Type of failure:  GHC rejects valid program  |  Unknown/Multiple
       Test Case:                             |       Difficulty:  Unknown
        Blocking:                             |       Blocked By:
                                              |  Related Tickets:
----------------------------------------------+----------------------------

Comment (by simonpj):

 As you say, the typechecker takes account of context (ie other in-scope
 equalities) so it's not a simple, local check. Code generated by
 `deriving` is typechecked separately (line 909 of `TcRnDriver`).  So it'd
 be reasonably easy to suppress "inaccessible code" warnings for generated
 code.

 There is a separate check for overlapping or fully-overlapped patterns at
 the desugaring stage.  This currently does NOT take account of GADTs etc,
 and there are many open tickets as a result. Re-doing the overlapping-
 pattern check would be an excellent thing. However, by the time code gets
 to the the overlap check, we've lost track of which code was generated by
 `deriving`.  It'd be possible, although a little tiresome, to retain that
 information.

 If someone wants to work on this, I could advise.

 Simon

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




More information about the ghc-tickets mailing list