Unreasonable Hackage requirement
I don't see a good reason why Hackage should insist that I manually activate -Wall -Werror in my dev environment, as it is my intention to never let new versions of GHC to swallow warnings. It helps early discovery, as it promotes early reports and proper reaction on changes from other people.
http code 400
Error: Invalid package
'ghc-options: -Wall -Werror' makes the package very easy to break with future
GHC versions because new GHC versions often add new warnings. Use just
'ghc-options: -Wall' instead. Alternatively, if you want to use this, make it
conditional based on a Cabal configuration flag (with 'manual: True' and
'default: False') and enable that flag during development.
make: *** [Makefile:30: release] Error 1
Posted Aug 12, 2021, 1:42 PM UTC · edited
Enabling
-Werrorfor libraries can only harm your users. It provides literally no benefit to them.It's easy enough to build with
-Werrorlocally or in CI. Withcabal, you can acabal.projectthat sets-Werrorfor your package without putting it in the.cabalfile.(cf this issue)
Likewise, with
stack, you can dostack build --ghc-options "-Werror"orstack build --pedanticor add a line in thestack.yaml.Yes, I know that packages could have optional stanzas based on manual flags.
But! How exactly is it harming users, if the package being published with non-optional
-Werrorhas never been used by them yet, and that all future warning-errors are supposed to be handled early with CI that use dev versions of GHC (i.e. way earlier than any user relying on the package in production could install it)?Not even that - you can keep your
.cabalfile clean of any optional/manual configuration flags and still have-Werrorin local builds. All build tools support this.So, you acknowledge that it harms users if you don't do those things. Got it!
It's a simple cost-benefit analysis.
There is no benefit to end-users for a library to have
-Werrorenabled in the.cabalfile. There is some cost - the library may fail to build with some untested GHC configuration due to different behavior of-Wall.There is some benefit to the library maintainer to have
-Werrorin the.cabalfile. Namely, they do not need to have a configuration setting for local development and CI. With modernstackandcabaluse, this is literally a single file with ~1-2 lines of config to enable-Werror. Same withnix- it is trivially easy to get-Werroroverlaid on your build. There are a lot of costs - keeping a codebase-Wallclean across multiple GHC releases is a pretty massive undertaking with a lot of work in CI and a lot ofCPP(which itself introduces build complexity and exhaustiveness problems).No I don't acknowledge it on general terms. I assumed it might be in the current status-quo situation where
-Werroris not advocated for in too many of the packages that should have had it in the first place, similarly tounsafePerformIOin unreasonable places that could easily avoid it with just an extra bit of effort.So, I'd like to ask you my original question again - how exactly is it going to harm users if it wasn't the the current status-quo situation, and if I used the described pipeline with Dev GHC in all my CI instances?
Fine, I am willing to pay this cost. Why am I not allowed to publish my package under these conditions?
okay, again
Why should end users want this? Why should Hackage - a platform that exists to serve the end users primarily - allow this?