-
Notifications
You must be signed in to change notification settings - Fork 37
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
Pattern guards sometimes don't promote #60
Comments
This smells like a desugaring bug. Will examine shortly. |
This is a desugaring bug, but it's a hard one to fix. The problem is that, when using a pattern guard, there are two possible ways for a match to fail: the pattern matching fails, or the guard eliminates a successful match. Desugaring takes both of these into account. In the definition of The solution would be to do a pattern completeness analysis. I believe that this is possible, but it's not a quick fix by any means. As a stop-gap measure, I suppose th-desugar could notice universal patterns and know that these are complete, but that wouldn't solve the problem in all cases. Regardless, this leads to yet another bug in GHC: overlapped (inaccessible) term-level pattern matches are a warning, but overlapped type-level pattern matches are an error. This is wrong. (It was my design choice, but I take it back.) I'll implement the "stop-gap" measure and post a bug in th-desugar. |
This is partially fixed, with the fix to goldfirere/th-desugar#6. Closing as wontfix, as this isn't really singletons's problem. |
Right. If this isn't singletons problem I'm changing wontifx to invalid ;-) |
Also, see GHC#9085. When that is fixed, this sort of problem becomes a warning in user code, not an error, which is an improvement. |
Running this code:
gives errors:
Rewriting
take
to explicitly usecase
works:Not sure if this is problem with singletons or th-desugar. Needs further investigation.
The text was updated successfully, but these errors were encountered: