- ; gbl_env <- addInsts deriv_inst_info getGblEnv
- ; return ( addTcgDUs gbl_env deriv_dus,
+
+ -- Extend the global environment also with the generated datatypes for
+ -- the generic representation
+ ; gbl_env <- addFamInsts (map ATyCon deriv_ty_insts) $
+ tcExtendGlobalEnv (map ATyCon (deriv_tys ++ deriv_ty_insts)) $
+ addInsts deriv_inst_info getGblEnv
+-- ; traceTc "Generic deriving" (vcat (map pprInstInfo deriv_inst_info))
+ ; return ( addTcgDUs gbl_env deriv_dus,