Description
GHC has a -ddump-minimal-imports
flag. Would it be possible to use the ghcide apparatus to write a new app to apply the minimal imports (optionally ignoring Prelude, perhaps) generated automatically?
For bonus points, it should also be possible to use the set of minimal imports across a project to add explicit export lists to each module using the minimal import lists.
Of course, weeder does some of this at the module level, but not the module contents level.
Presumably, this would help faster compilation and provide GHC with better optimization opportunities.
Undoubtedly the automatically-generated results would need hand tweaking, but I think that it might be a great help to some older code bases that have developed a certain amount of cruft that this sort of analysis could help improve. Doing it by hand, with a shell script or two would be one approach, but it would be good to have something a bit more robust (eg, preserving comments).
Perhaps someone has already done this.