-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
coverage: Use OverloadedRecordDot instead of RecordWildCards #2671
base: main
Are you sure you want to change the base?
coverage: Use OverloadedRecordDot instead of RecordWildCards #2671
Conversation
The CI failure tells me that this would bump the minimum required GHC version to 9.2. Any specific reason why we still support GHC 8.10? |
LGTM!
Not one from my side. cc @robx |
None that I'm aware of either. |
Removed on #2683 |
There's a blocker for OverloadedRecordDot on #2834. That will be solved once we offer a static binary for ARM. (or once Ubuntu upgrades GHC) |
ab2b874
to
95e6886
Compare
I rebased the first two commits, which were about The virtual fields approach would allow to rewrite stuff like this (random example): AppState.reReadConfig False appState into appState.reReadConfig False i.e. providing both the proper namespacing and less duplication. I don't understand while some of the CI jobs fail to build with an unused import warning while others build just fine (just like it does locally for me). |
95e6886
to
64559c8
Compare
The new |
As mentioned in #2627 (comment) and elsewhere before, we currently have quite a few false-negatives for coverage: Fields in record types are marked as uncovered, because we use
RecordWildCard
, which isn't supported by HPC.While
RecordWildCard
is not supported, I just found out thatOverloadedRecordDot
actually is.This is just a small example of what it could look like.
The key change is the following. Instead of
we do
I'm pretty sure the dot syntax will feel more natural to a lot of people.
Imho, it only makes sense when we remove all the prefixes for record fields, as done in the example above.
authResult.authClaims
etc. would just read very clumsy.At the same time, this also allows us to use the type itself in a namespaced way, too. We previously had to:
just to have the record field selectors available for
RecordWildCards
. But now we don't need to do that anymore - and we can just useAuth.AuthResult
from the qualified import. Of course, this then allows us to drop the prefix from the type, too, so we can export justResult
fromAuth.hs
and use it asAuth.Result
.If we were to use this style consistently, we'd get code coverage of our type definitions fixed. Before this MR, the
authClaims
field in the following was uncovered:Now, this line is covered, too.
WDYT?