
Within a set of modules, the minimal imports also give you the minimal
exports since each minimal export is required because it is imported
somewhere. Just compile all your modules with -ddump-minimal-imports,
then cat all your "*.import" files together and sort the result. The
minimal exports for module Foo will be listed as several lines of the
form "import Foo(x,y,z)", etc. From there on it's just a bit of text
munging to get it into your export list code (about two lines of
perl).
Michael D. Adams
2008/11/16 Jason Dagit
On Sun, Nov 16, 2008 at 5:35 AM, Thomas Schilling
wrote: The relevant flag is: -ddump-minimal-imports
See http://www.haskell.org/ghc/docs/latest/html/users_guide/flag-reference.html#...
The documentation says this:
-ddump-minimal-imports
Dump to the file "M.imports" (where M is the module being compiled) a "minimal" set of import declarations. You can safely replace all the import declarations in "M.hs" with those found in "M.imports". Why would you want to do that? Because the "minimal" imports (a) import everything explicitly, by name, and (b) import nothing that is not required. It can be quite painful to maintain this property by hand, so this flag is intended to reduce the labour.
I already know the minimal set of import for the modules. That's why I mentioned using -Wall; ghc will complain if you import something and don't use it.
The problem is that you can export names that never get used in other modules. I would like a tool that can look over a project and tell me which exported names are never imported. These names correspond to things that can be removed from the project.
Thanks, Jason
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe