Improve Error message when field is missing on actual Haskell record
<!--
READ THIS FIRST: If the feature you are proposing changes the language that GHC accepts
or adds any warnings to `-Wall`, it should be written as a [GHC Proposal](https://github.com/ghc-proposals/ghc-proposals/).
Other features, appropriate for a GitLab feature request, include GHC API/plugin
innovations, new low-impact compiler flags, or other similar additions to GHC.
-->
## Motivation
When having `-XOverloadedRecordDots` on and writing the following code
```haskell
data R = MkR
{ ri :: Int
, rs :: String
}
x :: R -> Bool
x r = r.rb
```
I get the following error message
```
• No instance for (GHC.Records.HasField "rb" R Bool)
arising from selecting the field ‘rb’
• In the expression: r.rb
In an equation for ‘x’: x r = r.rb
|
97 | x r = r.rb
| ^^^^
```
which is arguably too confusing if you just want to use this extension for allowing the record dot syntax.
## Proposal
As this is a Haskell record the error message could just have been "The Haskell record `R` does not have the field `rb`" which is in my opinion easier to decipher for users who don't want to use the actual overloading of the record dot. As it's possible to also declare `HasField` instances for some specific field name (`HasField "rb" R Bool`) it would probably be good to nevertheless include a NB that this error results from a missing `HasField` instance.
I would like to implement this my own, if this was accepted, but I'm new so guidance would be appreciated :smile:
Thanks in advance!
issue