
Simon is right, you cannot use a type family as an instance head. But why do you need to? Typically, if you're deriving a Data instance that involves type families, the type families would be inside another data type. A real-world example is HsBindLR [1]: data HsBindLR idL idR = FunBind { ... bind_fvs :: PostRn idL NameSet, ... } | ... where PostRn is a type family [2]. Now, you can't simply derive Data for HsBindLR, because GHC has no way of knowing what PostRn will evaluate to! But you can use standalone deriving to get what you want: deriving instance (Data (PostRn idL NameSet), ...) => Data (HsBindLR idL idR) And in fact, this is what GHC does [3], using a convenient type synonyms for the long, sprawling context you need [4]. So in your example, while you can't directly create a Data instance for NameOrRdrName itself, you can quite easily create Data instances for anything that might use NameOrRdrName. Does that work for your use cases? Ryan S. ----- [1] http://git.haskell.org/ghc.git/blob/bdc555885b8898684549eca70053c9ce0ec7fa39... [2] http://git.haskell.org/ghc.git/blob/bdc555885b8898684549eca70053c9ce0ec7fa39... [3] http://git.haskell.org/ghc.git/blob/bdc555885b8898684549eca70053c9ce0ec7fa39... [4] http://git.haskell.org/ghc.git/blob/bdc555885b8898684549eca70053c9ce0ec7fa39...