Error message for deriving type synonym is better and different with standalone deriving
Using standalone deriving
type My x = (Show x, Read x)
data Test = Test
deriving instance My Test
Error is:
<interactive>:19:25: error: [GHC-53946]
• Illegal instance for a type synonym
A class instance must be for a class
• In the stand-alone deriving instance for ‘My Test’
But with inline deriving data Test = Test deriving (My)
I am getting:
<interactive>:16:28: error: [GHC-11913] • Illegal deriving item ‘My’ • In the data declaration for ‘Test’
All same with explicit stock
strategy.
By the way: why type synonyms deriving is prohibited at all? Cannot GHC just try to expand it to regular constraints by rewriting type family?
- GHC version used: 9.6.1