
Dear Committee, Georgi Lyubenov has a simple proposal to improve the quality of life for many package maintainers that I recommend that we accept. ## Split -Wunused-imports Rendered proposal: https://github.com/googleson78/ghc-proposals/blob/split-unused-imports/propo... Discussion of proposal: https://github.com/ghc-proposals/ghc-proposals/pull/586 ### Summary (Straight from the proposal.) We propose to split the -Wunused-imports warning into two parts: - warn on actual unused imports - warn on duplicate imports while also not including the second in -Wall. This will greatly reduce "churn" for library authors. ## In more Detail As we know, many Haskell developers, including significant commercial projects, incorporate -Wall -Werror into their workflow at some stage. To this end it is important that we minimise 'false negatives', whereby the compiler emits 'frivolous' warnings. This proposal identifies an important class of -Wall warnings that many package maintainers appear to regard quite bothersome, namely when the compiler warns that import statement is superflous even when it is importing an entity that is being used by the module. The issue is the way `-Wunused-imports` works, which will issue a warning for the following program. ```haskell import X -- exports some function @f@ import y -- exports the same function @f@ g = f ``` The compiler will warn that the second Y import is redundant. Many developers do not want to be warned about this. As far as they are concerned each import is yielding enties that are in use and the fact that one of them can be removed is just not interesting. In contrast, developers that use -Wall do want to be warned about the following. ```haskell import X -- exports some function @f@ import Z -- does not export f g = f ``` Here our module has a completely false dependency on Z which should be cleaned up at the point that warnings are cleaned up. This proposal proposes modifying -Wunused-imports so that it will warn about the second example but stay silent for the first, and adds a -Wduplicate-imports that will issue a warning for the the first example. In effect the enabling of both warnings in the new proposal will restore the current -Wunused-imports behaviour. -Wall should *not* enable -Wduplicate-imports but is avilable to those developers that rely on the current behaviour of -Wunused-imports (which some clearly do). ## Recommendation I recommend that we accept this proposal.