-
Notifications
You must be signed in to change notification settings - Fork 199
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
Fix incomplete-record-updates warnings #1059
Fix incomplete-record-updates warnings #1059
Conversation
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.
Thanks for your efforts!
As it stands, I am opposed to code changes just to work around false positives in a GHC warning mechanism. If the warning is unsound, we should switch it off rather than change the code (unless we can change the code without making any sacrifices, but I do not see it here).
So I am +1 on silencing the warning with -Wno-...
, ideally in a per-file basis.
I am -1 on these code changes.
chunked | ||
. setHeader "Content-Encoding" "gzip" | ||
. setHeader "Vary" "Accept-Encoding" | ||
. removeResponseHeader "Content-Length" | ||
. removeResponseHeader "Content-MD5" | ||
. alterResponseHeader "ETag" (map modifyETag) | ||
$ r { rsBody = GZip.compressWith compressParams $ rsBody r } | ||
$ Response { rsBody = GZip.compressWith compressParams rsBody, .. } |
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.
I find this version (with the magic dots ..
in the record update) harder to comprehend. I consider this a fringe feature of GHC Haskell (I am seeing it for the first time now).
There might be some risks of unintentionally introducing bugs by shadowing one of the record fields introduced by the ..
pattern which is then picked up by the ..
update, is there?
I think that in the contrary we should strive to get rid of all the ..
magic and be more explicit about what is in scope.
So, I'd rather not change code to work around an incorrect GHC warning mechanism. Rather switch off the warning.
setHeader "Content-Length" (show rangeLen) | ||
. setHeaderBS (BS.C8.pack "Content-Range") (contentRange fr to fullLen) | ||
. removeResponseHeader "Content-MD5" | ||
$ r { rsBody = BS.Lazy.take rangeLen $ BS.Lazy.drop fr $ rsBody r | ||
$ Response |
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.
Same here, I am opposed.
8809e4d
to
178dcfd
Compare
It's not that -fwarn-incomplete-record-updates is unsound. |
Yes, this is mysterious. I am suspecting that the package-db caching is unsound: hackage-server/.github/workflows/ci.yml Lines 41 to 47 in 71bc801
I am pushing a new, idiomatic CI from |
I am ok with this modified PR. Using |
178dcfd
to
6e84bc2
Compare
Thank you for updating CI, LambdaCase suggestion applied. |
Thanks, @jhrcek ! |
Fixing some ghc warnings that show up in CI as discussed in #1056 (comment)
There are some issues in ghc with -fwarn-incomplete-record-updates giving false positives, e.g.
https://gitlab.haskell.org/ghc/ghc/-/issues/5728
https://gitlab.haskell.org/ghc/ghc/-/issues/17783
Some of those should be fixed in recent versions of GHC (9+),
but we can avoid them even on GHC 8 by using RecordWildCards trick mentioned here
The other instances of this warning are fixed by restructuring the code a bit to make it more obvious to GHC that all cases are handled.