HasField with QuantifedConstraints
Steps to reproduce
data Foo a = Foo { a :: Int }
data Bar where
Bar :: (forall a. HasField s (Foo a) Int) => Proxy s -> Bar
This throws a compile-time error:
Illegal instance declaration for ‘HasField s (Foo a) Int’
Foo has fields
Looking at TcValidity.hs, it seems like this error is thrown when manually defining instances, which is not relevant to me (at least, it could be doing it under the hood). I'm not sure if this is even allowed, but if it's not, the error message should be better.
Expected behavior
Either work or provide a more clear error message like "A HasFields constraint cannot be used with QuantifiedConstraints".
Environment
- GHC version used: 8.10.7, 9.2.1
Optional:
- Operating System:
- System Architecture: