How to find unused exported symbols?

I would like to find symbols exported from each module in a program that are not used outside the module. I'm worried my program is accumulating cruft. I'm looking for suggestions on how to find unused exported symbols. Do I have to analyse .hi files? Thanks in advance. John

Hmm... It looks like a useful tool to implement.
(Of course it does not make sense for libraries, only for executables)
It can be easily implemented using haskell-src-exts package.
2010/2/15 John D. Ramsdell
I would like to find symbols exported from each module in a program that are not used outside the module. I'm worried my program is accumulating cruft. I'm looking for suggestions on how to find unused exported symbols. Do I have to analyse .hi files? Thanks in advance.
John _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

On 16 February 2010 02:22, John D. Ramsdell
I would like to find symbols exported from each module in a program that are not used outside the module. I'm worried my program is accumulating cruft. I'm looking for suggestions on how to find unused exported symbols. Do I have to analyse .hi files? Thanks in advance.
-Wall will tell you which entities in are module are top-level but not exported; my SourceGraph program (available from Hackage) will tell you which entities in the entire project are top-level but not exported. Note that at the moment the output is rather ugly.... -- Ivan Lazar Miljenovic Ivan.Miljenovic@gmail.com IvanMiljenovic.wordpress.com Mike Ditka - "If God had wanted man to play soccer, he wouldn't have given us arms." - http://www.brainyquote.com/quotes/authors/m/mike_ditka.html

I wonder if I should use the GHC API to do this. I notice there is a
module called BinIface that contains a reader for interface files.
The trouble is you have to figure out how to initialize a program that
uses the module, and that seems to be difficult. I couldn't find
anything relevant on the Wiki.
John
On Mon, Feb 15, 2010 at 10:42 PM, Ivan Miljenovic
On 16 February 2010 02:22, John D. Ramsdell
wrote: I would like to find symbols exported from each module in a program that are not used outside the module. I'm worried my program is accumulating cruft. I'm looking for suggestions on how to find unused exported symbols. Do I have to analyse .hi files? Thanks in advance.
-Wall will tell you which entities in are module are top-level but not exported; my SourceGraph program (available from Hackage) will tell you which entities in the entire project are top-level but not exported. Note that at the moment the output is rather ugly....
-- Ivan Lazar Miljenovic Ivan.Miljenovic@gmail.com IvanMiljenovic.wordpress.com Mike Ditka - "If God had wanted man to play soccer, he wouldn't have given us arms." - http://www.brainyquote.com/quotes/authors/m/mike_ditka.html
participants (3)
-
Ivan Miljenovic
-
John D. Ramsdell
-
Yuras Shumovich