-
Notifications
You must be signed in to change notification settings - Fork 23
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
Exhaustiveness checking for non-arithmetic patterns #434
Conversation
…code I thought was good!)
… loops in list examples
Also, when running the tests, this is printed out (from when
The coverage checker is working correctly here, but I'm not sure if having a warning like this is the test output is an okay thing. All the tests still succeed, but it looks like the output from the disco-examples and the disco-test test suites overlap, like both are being run at the same time. This is not really a problem, but is worth noting. I am running (Also, when checking the log files for both test suites after this happens, the above coverage warning isn't in either of those. Maybe this is because the warning is printed on standard error? Also probably fine, but worth noting) |
Ah, indeed, the coverage checker is working correctly there, and it uncovered another problem: we should actually delete
Hmm, not sure, I'll look into this. |
…esolveAlias is good
…en noncontrol ascii then rest)
Then I will delete |
I originally did not consider case expressions, as I imagined students would only reach for case expressions when they had to check some boolean condition, which is not something the coverage checker can help with. Also I think that having the coverage checker work for some case expressions, but drop out the moment a boolean condition is introduced, might give students the wrong idea that adding the boolean condition covered all the cases (When in fact we just can't check it so we can't report any warnings). If we did add this, I am not sure the effort it would take, but it is definitely more work than I can do before the semester starts. I think we should just file an issue and come back to it later. |
Right, the way GHC handles this is to yield a warning every time there are Boolean guards with no catch-all case. So as long as you have a series of guards with an |
I am am now converting to disco patterns and using the pretty printer. There are two small things of note:
Both of these are technically correct behavior, so I am not too worried, and I think I am finally ready to merge. |
That's fine, that would make a nice improvement but not critical. Let's just make it into an issue for now.
Yeah, I think the default is to use escape sequences for any non-ASCII characters, since it's hard to know what kind of guarantees there are in terms of what font is being used, which characters it has glyphs for, etc. so it's safest to just use escape sequences for everything. This is perfectly fine and expected. Writing |
Co-authored-by: Restyled.io <commits@restyled.io>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! We don't need to worry about the failing doc build, since it looks like it is failing just because of missing configuration on this branch. As for the Restyled issue, I went ahead and merged the style fixes. Once the CI finishes running again I think this should be good to go.
@LeitMoth go ahead and apply the |
🎉 |
Implements the Lower Your Guards algorithm for coverage checking.
Makes significant progress on #32 (but does not complete it, as we don't handle arithmetic patterns).
To avoid false positives, we simply treat every arithmetic pattern as if it has the same coverage as a wildcard. I do not believe we can achieve a better result until a rework of arithmetic patterns is merged.
While I have not encountered a problem, I am marking this as a draft, as there are a few things that I would like to have reviewed:
These TODOs have to do with
resolveAlias
and should be read as a group. It seems to work with recursive type aliases, but I would like to be absolutely sure before merging:These TODOs have to do with
tyDataConsHelper
and should be read as a group. This function assumes that aliases have been resolved, and converts Disco types to lists of my custom data constructor type, which I needed to make for the LYG algorithm. I would like to be sure that I am not losing any important information in this conversion:These two are about comments / comment style:
And the surrounding comment around this one has details about the unhanded arithmetic stuff and asks if it is okay to leave it at what I have:
Of course, if I need to change/add any comments or code outside of these TODOs, let me know about that too.
Once all these and possibly a few new TODOs have been handled, I am excited to finally merge this.