dfithian / prune-juice

Prune unused Haskell dependencies.
MIT License
48 stars 4 forks source link

Parse re-exports in ghc-pkg exposed-modules #10

Closed elldritch closed 2 years ago

elldritch commented 3 years ago

Resolves #9.

I found the native ghc-pkg parser for InstalledPackageInfo from ghc-pkg's source code, and used that instead of a hand-rolled parser.

It looks like the breakage in #9 is indeed caused by re-exports. When an ExposedModule has a re-export, it appears to use this alternate syntax. It looks like first-class re-exports were introduced for Backpack, to describe "open modules" that where many modules can provide a specific signature.

elldritch commented 3 years ago

I also removed some dead code given the new parser. Ignore 2b349ab when reviewing to reduce noise in the diff (link to low-noise diff). In that commit, I removed a bunch of dead code and added module export lists (to more easily identify dead code).

dfithian commented 2 years ago

In general I like what you're doing here to fix this issue. Sorry about the merge conflicts. Once you rebase, would you mind adhering to the style conventions in each file and only making the necessary changes for parsing, just to keep the PR small?

dfithian commented 2 years ago

I reapplied your changes here: https://github.com/dfithian/prune-juice/pull/15