-
Notifications
You must be signed in to change notification settings - Fork 120
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
Remove Overlapping pragmas #84
Conversation
Use a closed type family to avoid the need for overlapping instances. This shouldn't really affect anything, but it makes instance selection more explict.
Hmm... This actually seems to prevent some things from working. Some things that maybe shouldn't work? I need to consider this a bit more. |
Specifically, GHC seems happy to fall back on the overlapping "not this one" instance quite readily when confronted with the question of whether, e.g., |
Hi, It is quite worrying if Note that I can't merge this change directly because closed type families are only supported from GHC 7.8 upwards. But if there are cases where GHC picks the wrong instance with |
I don't actually know if this can go wrong. Type family reduction is very conservative because GHC can't always recognize infinite types. You can write type family Ugh a where
Ugh a = (a, Ugh a) This can, of course, throw the type checker into an infinite loop when it's reduced, which is okay. But the existence of such families precludes GHC from implementing a general type family (==) a b where
a == a = 'True
a == b = 'False as |
I prefer closed type families to overlapping instances as a matter of taste (though I don't really love either). It would, I think, take some experimentation to determine whether the type family implementation reduces under circumstances typical for |
Yikes, I see. That's quite nasty! I also prefer closed type families to overlapping instances. But I don't want to break QuickCheck on GHC 7.6 (still the default version on e.g. Debian stable) so let's make this change in the future. |
Closing this as completed via #370 |
Use a closed type family to avoid the need for overlapping
instances. This shouldn't really affect anything, but
it makes instance selection more explict.