Hey all!
I’ve made a proposal to split -Wunused-imports
into two warnings:
-
-Wunused-imports
- warn when an import is “actually unused”
-
-Wduplicate-imports
- warn when a definition is imported more than once
Crucially, only the first one will be in -Wall
.
I believe this will greatly benefit maintaining packages against multiple GHC versions, but I would rather not mess something up, so I would love to hear more opinions in the proposal itself - Split -Wunused-imports by googleson78 · Pull Request #586 · ghc-proposals/ghc-proposals · GitHub
6 Likes
I think at some point, the responsibility can be shifted to static analytics such as hlint. The duplicated imports seem definitely a straightforward one hlint can catch.
1 Like
hlint
in particular (by design iirc) only does parsing, so it
- can’t know if two
f
s are the same f
- cannot see what an import without an import list brings into scope
I think you need to do a full build at least once for this particular warning, so at that point it’s more convenient to just put it in ghc
itself. I agree that this is rather unsatisfying, but it would be a much more long term project to change this
2 Likes