GHC issueshttps://gitlab.haskell.org/ghc/ghc/-/issues2019-09-03T17:46:05Zhttps://gitlab.haskell.org/ghc/ghc/-/issues/16496feature request: warn if OverloadedStrings provides valid semantics2019-09-03T17:46:05ZAyman Nadeemfeature request: warn if OverloadedStrings provides valid semantics#### Feature Request
Generate warning if you don’t have `OverloadedStrings` on, and you provided another type (such as `[Char]`) where you expected something with an `IsString` instance.
GHC can look up whether the type in question has...#### Feature Request
Generate warning if you don’t have `OverloadedStrings` on, and you provided another type (such as `[Char]`) where you expected something with an `IsString` instance.
GHC can look up whether the type in question has an `IsString` instance, from `Data.String`, rather than assuming that the programmer should have looked up to see whether there _is_ an instance of `IsString` for the desired type.
If the type in question _does_ have an IsString instance, it can warn that you need one. If it doesn’t, then it should produce the same error.
#### Example
When experiencing this error due to use of `[Char]`, it was not immediately clear based on the message that `OverloadedStrings` was required:
```
error:
• Couldn't match expected type 'text-1.2.3.1:Data.Text.Internal.Text'
with actual type '[Char]'
• In the second argument of '(.:)', namely '"name"'
In the second argument of '(<$>)', namely 'v .: "name"'
In the first argument of '(<*>)', namely 'SumType <$> v .: "name"'
|
35 | <$> v .: "name"
| ^^^^^^
```