Cannot newtype-derive Ord1 instances after gaining a quantified superclass in HEAD
_(Originally observed in a `head.hackage` build [here](https://gitlab.haskell.org/ghc/head.hackage/-/jobs/1177652#L2753).)_
After commit 7beb356e944bf3415394fd6aeb7841aca5759020, the `bifunctors-5.5.13` and `endo-0.3.0.1` libraries on Hackage fail to compile. Here is a minimized example:
```hs
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE StandaloneDeriving #-}
module Bug where
import Data.Functor.Classes
newtype T f a = MkT (f a)
deriving ( Eq, Ord, Eq1
, Ord1
)
```
While this compiles with GHC 9.4 and earlier, this fails to compile on HEAD:
```
$ ~/Software/ghc-9.5.20220920/bin/ghc Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
Bug.hs:9:14: error: [GHC-39999]
• Could not deduce ‘Eq (f a)’
arising from a superclass required to satisfy ‘Ord (f a)’,
arising from a superclass required to satisfy ‘Ord1 f’,
arising from the 'deriving' clause of a data type declaration
from the context: Ord1 f
bound by the deriving clause for ‘Ord1 (T f)’ at Bug.hs:9:14-17
or from: Ord a bound by a quantified context at Bug.hs:9:14-17
• When deriving the instance for (Ord1 (T f))
|
9 | , Ord1
| ^^^^
Bug.hs:9:14: error: [GHC-39999]
• Could not deduce ‘Eq (f a)’
arising from a superclass required to satisfy ‘Eq1 f’,
arising from a superclass required to satisfy ‘Ord1 f’,
arising from the 'deriving' clause of a data type declaration
from the context: Ord1 f
bound by the deriving clause for ‘Ord1 (T f)’ at Bug.hs:9:14-17
or from: Eq a bound by a quantified context at Bug.hs:9:14-17
• When deriving the instance for (Ord1 (T f))
|
9 | , Ord1
| ^^^^
```
A workaround is to use `StandaloneDeriving`:
```hs
newtype T f a = MkT (f a)
deriving ( Eq, Ord, Eq1
-- , Ord1
)
deriving instance Ord1 f => Ord1 (T f)
```
However, it feels like a `deriving` clause ought to be able to do this just as well.
issue