I’m supportive of this proposal. I think Adam raised a good concern on the discussion with respect to tooling. As this does not impact GHCs acceptance of existing code, I’m more lenient towards these changes.

Moritz

On Sat, 9 Sep 2023 at 5:43 AM, Simon Peyton Jones <simon.peytonjones@gmail.com> wrote:
I'm supportive of this proposal in general -- that is, make it easy to find what the "root" unused bindings are, without cluttering up the warnings with all the transitively unused ones.

But I have a question (added on the discussion thread) about the ergonomics.

On Fri, 8 Sept 2023 at 03:16, Chris Dornan <chris@chrisdornan.com> wrote:
Proposal: Fine-Grained Unused Warnings (#42)
Author: Jakob Brünker
Recommendation: Acceptance

## Summary

GHC currently warns equally about any superfluous binding that it discovers, regardless of whether
the definition is unreferenced anywhere itself, or is merely mentioned by other definitions that are
similarly superfluous. The proposal proposes to replace these warnings with just the warnings about
definitions that are not referenced anywhere, but list within those warnings the entities it
references that would otherwise not be required. The same information is being conveyed under this
proposal as previously, but in a more structured manner.

The proposal is careful to ensure the -Wunused-* controls (-Wunused-top-binds, etc.) are respected,
so the subwarnings of transitively unused entities are only listed if their corresponding -Wunused-*
control is active.

As Jakob points out in the proposal, getting these warnings into some structure is partly motivated
by IDE usage where the 'additional [transitive] warnings take up a lot of valuable screen real
estate'.

## Example [From the proposal]

In the following code,

module Foo ()

import Data.List as L

foo = L.intercalate

`intercalate` is transitively unused, since it is only used by `foo`, which is unused. The warning
that's produced will be

Foo.hs:5:1: warning: [-Wunused-top-binds]
Defined but not used: ‘foo’
as a consequence the following imports are transitively unused [-Wunused-imports]:
Data.List imported at foo.hs:3:1:

The warning about transitively unused bindings only appears if both the warning flag for the unused binding (in this case -Wunused-top-binds) and the the one for the transitively unused binding itself (in this case -Wunused-imports) are enabled.


## Recommendation

This proposal is not at all disruptive (arguably to the extent of not requiring a GHC proposal
review), is well thought out, and can improve the GHC/IDE UI so I recommend that we accept it.

_______________________________________________
ghc-steering-committee mailing list
ghc-steering-committee@haskell.org
https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee
_______________________________________________
ghc-steering-committee mailing list
ghc-steering-committee@haskell.org
https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee