Is there a way to parse haskell
source and for given import check if it is redundant?
haskell-src
should be useful, but I've found nothing similar here.
There is a nice new package called module-management that has the functionality you need. It has a cleanImports function that does exactly what it sounds like. It also has a bunch of other facilities for managing modules that may be useful.
The main problem I see--not having used the package myself--is that the cleanImports
function does quite a bit all at once. If you want functions at a higher granularity, you will either have to look through other parts of the package or maybe even factor out some basic functionality yourself. That said, I think this package is the perfect place to start.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With