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

Warn on unreachable instances in chains #4441

Open
rhendric opened this issue Feb 28, 2023 · 0 comments
Open

Warn on unreachable instances in chains #4441

rhendric opened this issue Feb 28, 2023 · 0 comments

Comments

@rhendric
Copy link
Member

Summary

As suggested here, it would be nice to detect when an instance chain contains instances that could never be selected because they're dominated by preceding instances in the chain and warn the user. Perhaps also include a message mentioning that constraints aren't used until after an instance is selected, or suggesting a reordering of the instances.

Motivation

See #4440 for this confusing someone in the wild.

Proposal

TBD, but doesn't seem that complicated.

Examples

Case where we might mention that constraints aren't used until after selection:

instance Show a => Foo a
else instance Foo a

Case where we might suggest a reordering:

instance Foo String a
else instance Foo a String
else instance Foo String String
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant