[ghc-steering-committee] #571: -Wsevere, Shepherd: Adam (rec: accept)

Adam Gundry adam at well-typed.com
Thu Sep 14 08:32:47 UTC 2023


Dear Committee,

Joachim, along with Oleg Grenrus, proposes to change -Wmissing-methods 
and -Wmissing-fields warnings into errors by default (retaining the 
option to downgrade them). I recommend we accept the proposal.

Proposal: https://github.com/ghc-proposals/ghc-proposals/pull/571
Rendered: 
https://github.com/ghc-proposals/ghc-proposals/blob/wsevere/proposals/0000-severe-warnings.rst

This is primarily motivated by the fact that when classes have default 
methods, missing methods can lead to runtime loops, which are generally 
difficult to debug. Since in practice not all users pay attention to 
warnings that do not inhibit compilation, it makes sense to identify a 
class of warnings that are sufficiently serious to require explicit 
action from the user to silence them.

Since these warnings are currently not errors by default, library 
authors experimentally assessing the impact of changes may be lead to 
assume that introducing new methods/fields does not lead to breakage 
(because downstream code will still compile). The proposal thus makes it 
more obvious that adding a new method or field is a breaking change.

The proposal deliberately causes builds to fail by default for some 
libraries that currently emit warnings. Oleg has kindly performed impact 
assessments to identify such libraries, and the breakage of a few 
packages seems worth the cost.

It is easy to restore the warnings to their previous classification by 
passing an option at build time, e.g. using -Wno-error=missing-methods. 
Users can set such an option in cabal.project or stack.yaml to work 
around breakage that is not promptly fixed by the library author.

This change does mean that GHC with -XHaskell98/2010 will by default 
reject some programs that are explicitly permitted by the Haskell98/2010 
specification. I recommend we document this infelicity, but accept it, 
as much of the benefit of the proposal is that it applies by default.

The proposal establishes the precedent that some warnings may be treated 
as errors by default, and introduces a warning group -Wsevere to 
classify them. This seems conceptually useful and gives us the option to 
extend the -Wsevere set in the future (e.g. as a final stage of 
deprecation before a feature is removed).

Thoughts?

Adam


On 11/09/2023 20:25, Joachim Breitner wrote:
> Dear Committee,
> 
> based on suggestions by Oleg Grenrus, I wrote a proposal to introduce a
> warning group -Wsevere for on-by-defaults, error-by-default warnings,
> and initially fill it with missing-methods and missing-fields.
> 
> 
> https://github.com/ghc-proposals/ghc-proposals/pull/571
> 
> https://github.com/ghc-proposals/ghc-proposals/blob/wsevere/proposals/0000-severe-warnings.rst
> 
> I’d like to nominate Adam as the shepherd, who already reviewed it a
> bit on Github.
> 
> Please guide us to a conclusion as outlined in
> https://github.com/ghc-proposals/ghc-proposals#committee-process
> 
> 
> Cheers,
> Joachim


-- 
Adam Gundry, Haskell Consultant
Well-Typed LLP, https://www.well-typed.com/

Registered in England & Wales, OC335890
27 Old Gloucester Street, London WC1N 3AX, England



More information about the ghc-steering-committee mailing list