[GHC] #6147: GeneralizedNewtypeDeriving should fail with data families

GHC cvs-ghc at haskell.org
Wed Jun 6 13:10:38 CEST 2012


#6147: GeneralizedNewtypeDeriving should fail with data families
-----------------------------------------+----------------------------------
 Reporter:  rl                           |          Owner:                  
     Type:  bug                          |         Status:  new             
 Priority:  normal                       |      Component:  Compiler        
  Version:  7.2.1                        |       Keywords:                  
       Os:  Unknown/Multiple             |   Architecture:  Unknown/Multiple
  Failure:  GHC accepts invalid program  |       Testcase:                  
Blockedby:                               |       Blocking:                  
  Related:                               |  
-----------------------------------------+----------------------------------
 Here is an example:

 {{{
 {-# LANGUAGE GeneralizedNewtypeDeriving, TypeFamilies #-}
 module Foo where

 data family T a
 data instance T Int = T_Int Int

 class C a where
   foo :: a -> T a

 instance C Int where
   foo = T_Int

 newtype Foo = Foo Int deriving(C)
 }}}

 The `deriving(C)` clause on `Foo` should fail but instead it derives an
 instance which can't possible be correct since there is no corresponding
 `data instance T Foo`. This is closely related to #2721 (where newtype
 deriving was disabled in the presence of associated types) but much more
 difficult to test for. Probably also related to #1496.

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



More information about the Glasgow-haskell-bugs mailing list