haskell / haskell/haskell-language-server

[new plugin] Add explicit export lists to each module using the minimal import lists

Open
#450 13 comments 0 reactions 0 assignees View on GitHub
type: enhancement
Dominant language
Haskell
Stars
3k
Forks
455
Avg merge
2d 19h
Merged PRs (30d)
11

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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.