[ghc-steering-committee] #571: -Wsevere, Shepherd: Adam (rec: accept)
Richard Eisenberg
lists at richarde.dev
Mon Sep 18 19:28:20 UTC 2023
I'm tentatively in favor here.
* I really want this!
* I'm worried about backward compatibility. I'm pretty sure I've seen an idiom where you have
> data R a = Mk
> { f1 :: Int
> , f2 :: Bool
> , f3 :: a
> }
>
> deflt :: forall a. R a
> deflt = { f1 = 42, f2 = False }
and then override f3 via a record update. Of course, a function would work better, but we don't always get "better".
Along similar lines, I can easily imagine
> instance Num Nat where
> (+) = ...
> (*) = ...
> -- no negate or abs
If the programmer were to implement negate, say, the implementation would just be a call to error, so why even bother when GHC helpfully supplies that implementation for you? Again, this isn't the way I would do it, but it's not absurd.
Bottom line for me: I think we should implement and then experiment. Given the potentially delicate nature of this, I might even advocate for implementing this in a release branch, so that as much of Hackage as possible actually has a hope of compiling. Then test to see where the breakage occurs. If were happy with the result, rebase the implementation on master. But I don't want us to get into a state where we accept, implement, observe moderate breakage, and then blast ahead because the committee approved the idea.
Richard
PS: Next additions to -Wsevere: type-errors (replacing -fdefer-type-errors), out-of-scope-errors (replacing -fdefer-scope-errors), partial-type-signatures (replacing -XPartialTypeSignatures), and maybe even derive-functor and friends (replacing -XDeriveFunctor). All of this can be done entirely backward-compatibly!
> On Sep 18, 2023, at 9:37 AM, Arnaud Spiwack <arnaud.spiwack at tweag.io> wrote:
>
> (I'd argue that most errors can be turned into warnings via -fdefer-type-errors. It's really coarse though.)
>
> When reading the summary, I was anticipating voting against the proposal, turning warnings into errors by default creates spurious work for package maintainers. But I think I'm now convinced. Joachim & Oleg's point is that we want to consider creating additional `-Wsevere` warnings *to not be backward compatible*. It's an obligation on GHC designers, and on package maintainers: such change must be considered very carefully and must be properly documented. If we break compatibility this way, we want to trigger as many errors as possible, so that packages get fixed (which they almost certainly need to).
>
> This is the criterion for having a warning be part of `-Wsevere`. And the two first contestants (missing methods and missing fields) absolutely seem to fit the bill.
>
> So I'm in favour.
>
> I have no opinion about whether there is a better way to describe the spectrum of error-to-warning, as per Simon's musing.
>
> I agree that the CLC should be consulted on this, as it also imposes duties on them.
>
> /Arnaud
>
> On Thu, 14 Sept 2023 at 11:10, Simon Peyton Jones <simon.peytonjones at gmail.com <mailto:simon.peytonjones at gmail.com>> wrote:
> 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'm fine with making these errors, provided the impact on library authors is not too severe. But this is a breaking change and people will shout at us.
>
> Moritz, on the face of it this is just the kind of thing you dislike -- and yet it makes it much harder to inadvertently create truly nasty bugs.
>
> This doesn't affect the API of base, and so is no in CLC purview, but I'd quite like to ask their opinion. What I don't want is for us to accept it, and then have a firestorm of complaints. I think the case is strong: debugging infinite loops is very painful.
>
> The proposal establishes the precedent that some warnings may be treated
> as errors by default
>
> This is a funny thing. A warning that is an error by default is perhaps.. an error? Or to put it another way, perhaps all errors are just warnings that are treated as errors by default?
>
> Perhaps this new beast is an error that can be turned into a warning? (Most errors cannot.)
>
> I'm not arguing against the proposal, just wondering if there is a simpler way to say this.
>
> Simon
>
>
>
> On Thu, 14 Sept 2023 at 09:33, Adam Gundry <adam at well-typed.com <mailto:adam at well-typed.com>> wrote:
> 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 <https://github.com/ghc-proposals/ghc-proposals/pull/571>
> Rendered:
> https://github.com/ghc-proposals/ghc-proposals/blob/wsevere/proposals/0000-severe-warnings.rst <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/pull/571>
> >
> > https://github.com/ghc-proposals/ghc-proposals/blob/wsevere/proposals/0000-severe-warnings.rst <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 <https://github.com/ghc-proposals/ghc-proposals#committee-process>
> >
> >
> > Cheers,
> > Joachim
>
>
> --
> Adam Gundry, Haskell Consultant
> Well-Typed LLP, https://www.well-typed.com/ <https://www.well-typed.com/>
>
> Registered in England & Wales, OC335890
> 27 Old Gloucester Street, London WC1N 3AX, England
>
> _______________________________________________
> ghc-steering-committee mailing list
> ghc-steering-committee at haskell.org <mailto:ghc-steering-committee at haskell.org>
> https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee <https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee>
> _______________________________________________
> ghc-steering-committee mailing list
> ghc-steering-committee at haskell.org <mailto:ghc-steering-committee at haskell.org>
> https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee <https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee>
>
>
> --
> Arnaud Spiwack
> Director, Research at https://moduscreate.com <https://moduscreate.com/> and https://tweag.io <https://tweag.io/>.
> _______________________________________________
> ghc-steering-committee mailing list
> ghc-steering-committee at haskell.org
> https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-steering-committee/attachments/20230918/e5d890f7/attachment-0001.html>
More information about the ghc-steering-committee
mailing list