feature request: warn if OverloadedStrings provides valid semantics
Generate warning if you don’t have
OverloadedStrings on, and you provided another type (such as
[Char]) where you expected something with an
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.
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-18.104.22.168: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" | ^^^^^^