Provide instance of a class and it superclass at once (feature)

Maybe this was discussed somewhere, but it’s not easy to find.
Why couldn’t we provide instance of a one-parameterized type class with superclass mathods like

instance Monoid x where
  a <> b = ...
  mempty = ...

making it be Semigroup and Monoid at the same time? That’s maybe not a good choice in this case, but how about classes, that now contain several methods, but can be splitted in the future? It seems, that this could reduce the backward compatibility problems significantly.

2 Likes

See default superclass instances · Wiki · Glasgow Haskell Compiler / GHC · GitLab and intrinsic superclasses · Wiki · Glasgow Haskell Compiler / GHC · GitLab.

3 Likes