Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document GHC-97044 #445

Merged
merged 2 commits into from
Jul 13, 2023
Merged

Document GHC-97044 #445

merged 2 commits into from
Jul 13, 2023

Conversation

jhrcek
Copy link
Collaborator

@jhrcek jhrcek commented Jul 9, 2023

No description provided.

@BinderDavid BinderDavid self-assigned this Jul 9, 2023
This restriction applies to the following type classes:

- [Coercible](https://hackage.haskell.org/package/base/docs/Data-Coerce.html#t:Coercible) - This class does not have regular instances; instead they are created on-the-fly during type-checking.
- [HasField](https://hackage.haskell.org/package/base/docs/GHC-Records.html#t:HasField) - This class is used by [OverloadedRecordDot](https://downloads.haskell.org/ghc/latest/docs/users_guide/exts/overloaded_record_dot.html) and related extensions.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least for the HasField typeclass it is possible to create user-written instances. See for example my library here: https://github.com/BinderDavid/tuple-fields/blob/main/src/Data/Tuple/Fields.hs

Copy link
Collaborator Author

@jhrcek jhrcek Jul 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. Seems like I was misled by browsing around GHC codebase and I interpreted this

https://github.com/ghc/ghc/blob/2af23f0e84eec0eb30d77134abd99858a02d7a18/compiler/GHC/Tc/Validity.hs#L1460

to mean that HasField can also trigger this warning.
But after deeper look it seems to be related to other "validations" done on instances of this type class.

As for other typeclasses mentioned, I'm pretty sure they should be there as I saw them mentioned in warnings in ghc test suite: https://github.com/search?q=repo%3Aghc%2Fghc%2097044&type=code

Copy link
Collaborator

@BinderDavid BinderDavid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I have one suggested change in grammar, and I think the HasField typeclass does not belong in that list.

@jhrcek jhrcek requested a review from BinderDavid July 13, 2023 11:52
@BinderDavid BinderDavid merged commit e22a9ac into haskellfoundation:main Jul 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants