FlexibleInstances should be recommended instead of TypeSynonymInstances
Summary
When using a type synonym in an instance definition the language extension TypeSynonymInstances is recommended. When TypeSynonymInstances is applied the language extension FlexibleInstances is recommended. This is annoying and should just recommend the appropriate extension for a quick fix.
Steps to reproduce
ghci -fno-glasgow-exts
import Text.Printf
instance IsChar String where fromChar = (: [])
:set -XTypeSynonymInstances
instance IsChar String where fromChar = (: [])
Expected behavior
$ ghci -fno-glasgow-exts
\> import Text.Printf
\> instance IsChar String where fromChar = (: [])
<interactive>:2:10: error:
Illegal instance declaration for ‘IsChar String’
(All instance types must be of the form (T t1 ... tn)
where T is not a synonym.
Use TypeSynonymInstances if you want to disable this.)
In the instance declaration for ‘IsChar String’
\> :set -XTypeSynonymInstances
\> instance IsChar String where fromChar = (: [])
<interactive>:4:10: error:
Illegal instance declaration for ‘IsChar String’
(All instance types must be of the form (T a1 ... an)
where a1 ... an are *distinct type variables*,
and each type variable appears at most once in the instance head.
Use FlexibleInstances if you want to disable this.)
In the instance declaration for ‘IsChar String’
Environment
- GHC version used: 9.2.7
Optional:
- Operating System: OpenBSD 7.4
- System Architecture: x86_64