- can_derive = isJust maybe_rep_app -- The rep type is a type constructor app
- && (tyVarsOfTypes args_to_keep `subVarSet` mkVarSet tyvars_to_keep)
+ standard_instance = null tys && classKey clas `elem` derivableClassKeys
+
+ can_derive_via_isomorphism
+ = not (clas `hasKey` readClassKey) -- Never derive Read,Show this way
+ && not (clas `hasKey` showClassKey)
+ && not (isRecursiveTyCon tycon) -- Newtype isn't recursive
+ && isJust maybe_rep_app -- The rep type is a type constructor app
+ && (tyVarsOfTypes args_to_keep `subVarSet` mkVarSet tyvars_to_keep)