id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc,os,architecture,failure,difficulty,testcase,blockedby,blocking,related
2850,GeneralizedNewtypeDeriving + TypeFamilies doesn't work,ajd,,"It would be nice if we could do stuff like this:

{{{
{-# LANGUAGE GeneralizedNewtypeDeriving, TypeFamilies, FlexibleContexts, FlexibleInstances #-}
class K a where
  bar :: a -> a

class K (B a) => M a where
  data B a :: *
  foo :: B a -> B a

instance M Bool where
  data B Bool = B1Bool Bool | B2Bool Bool
  foo = id

instance K (B Bool) where
  bar = id

instance M Int where
  newtype B Int = BInt (B Bool) deriving K
  foo = id
}}}

which currently gives the error

{{{
foo.hs:17:41:
    Can't make a derived instance of `K (B Int)'
      (even with cunning newtype deriving:
       the newtype may be recursive)
    In the newtype instance declaration for `B'
}}}

However, the newtype is not recursive, it is just an associated datatype from another class, so it seems like this ought to work.",feature request,closed,normal,6.12 branch,Compiler,6.10.1,fixed,,pumpkingod@… dons@…,Unknown/Multiple,Unknown/Multiple,,Unknown,indexed_types/should_compile/T2850,,,
