+ -- Generate EarlyDerivSpec's for Generic, if asked for
+ -- ; (xGenerics, xDerRep) <- genericsFlags
+ ; xDerRep <- genericsFlag
+ ; let allTyNames = [ tcdName d | L _ d <- tycl_decls, isDataDecl d ]
+ -- ; allTyDecls <- mapM tcLookupTyCon allTyNames
+ -- Select only those types that derive Generic
+ ; let sel_tydata = [ tcdName t | (L _ c, L _ t) <- all_tydata
+ , getClassName c == Just genClassName ]
+ ; let sel_deriv_decls = catMaybes [ getTypeName t
+ | L _ (DerivDecl (L _ t)) <- deriv_decls
+ , getClassName t == Just genClassName ]
+ ; derTyDecls <- mapM tcLookupTyCon $
+ filter (needsExtras xDerRep
+ (sel_tydata ++ sel_deriv_decls)) allTyNames
+ -- We need to generate the extras to add to what has
+ -- already been derived
+ ; generic_extras_deriv <- mapM mkGenDerivExtras derTyDecls
+ -- For the remaining types, if Generics is on, we need to
+ -- generate both the instances and the extras, but only for the
+ -- types we can represent.
+{-
+ ; let repTyDecls = filter canDoGenerics allTyDecls
+ ; let remTyDecls = filter (\x -> not (x `elem` derTyDecls)) repTyDecls
+ ; generic_instances <- if xGenerics
+ then mapM mkGenDerivSpec remTyDecls
+ else return []
+ ; generic_extras_flag <- if xGenerics
+ then mapM mkGenDerivExtras remTyDecls
+ else return []
+-}
+ -- Merge and return everything
+ ; return ( eqns1 ++ eqns2 -- ++ generic_instances
+ , generic_extras_deriv {- ++ generic_extras_flag -}) }