#4528: stand-alone deriving sometimes fails for GADTs
------------------------------------------+---------------------------------
    Reporter:  nestra                     |        Owner:                       
                                 
        Type:  bug                        |       Status:  merge                
                                 
    Priority:  normal                     |    Milestone:                       
                                 
   Component:  Compiler (Type checker)    |      Version:  7.0.1                
                                 
    Keywords:  deriving mechanism, GADTs  |     Testcase:  
deriving/should_fail/T4528, deriving/should_run/T4528a
   Blockedby:                             |   Difficulty:                       
                                 
          Os:  Linux                      |     Blocking:                       
                                 
Architecture:  x86_64 (amd64)             |      Failure:  Compile-time 
performance bug                          
------------------------------------------+---------------------------------
Changes (by simonpj):

  * status:  new => merge
  * testcase:  => deriving/should_fail/T4528, deriving/should_run/T4528a


Comment:

 OK two patches.  This one tightens up the defn of what can be
 enumerations.
 {{{
 Wed Dec 15 04:19:27 PST 2010  [email protected]
   * Tighten up what it means to be an "enumeration data constructor"

   See Note [Enumeration types] in TyCon, and comments in Trac #4528

     M ./compiler/iface/BuildTyCl.lhs -2 +6
     M ./compiler/types/TyCon.lhs -1 +11
 }}}
 As a result you now get
 {{{
 T4528.hs:10:1:
     Can't make a derived instance of `Enum (Foo a)':
       `Foo' is not an enumeration type
       (an enumeration consists of one or more nullary, non-GADT
 constructors)
     In the stand-alone deriving instance for `Enum (Foo a)'
 }}}
 A second patch fixes a bug in the byte code generator, whereby it didn't
 know that an enumeration can (in GHC) have a phantom argument:
 {{{
 data T a = A | B | C
 }}}
 This crashes 7.0.1 when loaded into GHCi.  Fixed by
 {{{
 Wed Dec 15 12:18:17 GMT 2010  [email protected]
   * Allow enumerations to have phantom arguments.

   The bytecode generator was being too eager.
   Fixes Trac #4528, or rather, a near variant.

     M ./compiler/ghci/ByteCodeGen.lhs -2 +2
 }}}
 Both have tests; both could be merged.

 Simon

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

_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to