coverage: Use OverloadedRecordDot instead of RecordWildCards #2671
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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?