Getting a function dependency graph from source
Hello. This seems like a basic question, but I haven't been able to find an answer. I have a pile of Haskell code that is compiled into a library, and a Haskell program that uses this library. What I would like is something that will look at my program and follow the function calls until it gets to the Prelude. I want to know which functions in the library and in the Prelude actually get used (at least potentially). I believe Hat only looks at traces of an actual run of the program, and so doesn't quite give me what I want. I also think I could do this with the haskell-src library, but it looks like a lot of work to understand that and use it. Thanks. -- Durward McDonell durward.mcdonell@jhuapl.edu
Hi, The pfe command line tool from the Programatica Project has functionality that seems to fit fairly well with what you are asking for: pfe deps -- lists function level dependencies pfe needed -- lists everything needed by a definition pfe dead -- lists unused definitions pfe slice -- extract a slice by eliminating unused defintions For more information, and downloads, see http://www.cse.ogi.edu/~hallgren/Programatica/download/ Thomas H Durward McDonell wrote:
Hello. This seems like a basic question, but I haven't been able to find an answer. I have a pile of Haskell code that is compiled into a library, and a Haskell program that uses this library. What I would like is something that will look at my program and follow the function calls until it gets to the Prelude. I want to know which functions in the library and in the Prelude actually get used (at least potentially).
Thanks.
Yes, this is exactly what I wanted! Thanks, and thanks for writing it all in the first place. :-) However, I haven't quite been able to get it to work fully. I did get it installed and running, after I took the advice about using the latest versions and just installing the binaries. I even got pfe to add all my files and all the relevant ghc-6.4.2 libraries and Prelude. However, "pfe chase" only worked on my files, and not on, say, /usr/local/src/ghc-6.4.2/libraries/base/parsec. I had to add all the ghc files one at a time. Also, now that pfe is satisfied that it needs no more modules, if I run "pfe deps", for example, it complains that I have many undefined export entries. All of the functions listed are Prelude functions. I have the "prelude" option set to True. It seems like I'm very close. What am I doing wrong? Here's the output of "pfe options", fwiw: Flags {prel = True, plogic = True, cpp = Just "/lib/cpp -traditional -P -D__HASKELL98__ -D__PFE__ -I/usr/local/src/ghc-6.4.2/libraries/base/include"} Thanks again. On Wed, 2006-10-11 at 16:32 -0700, Thomas Hallgren wrote:
Hi,
The pfe command line tool from the Programatica Project has functionality that seems to fit fairly well with what you are asking for:
pfe deps -- lists function level dependencies pfe needed -- lists everything needed by a definition pfe dead -- lists unused definitions pfe slice -- extract a slice by eliminating unused defintions
For more information, and downloads, see
http://www.cse.ogi.edu/~hallgren/Programatica/download/
Thomas H
Durward McDonell wrote:
Hello. This seems like a basic question, but I haven't been able to find an answer. I have a pile of Haskell code that is compiled into a library, and a Haskell program that uses this library. What I would like is something that will look at my program and follow the function calls until it gets to the Prelude. I want to know which functions in the library and in the Prelude actually get used (at least potentially).
-- Durward McDonell durward.mcdonell@jhuapl.edu
Durward McDonell wrote:
Yes, this is exactly what I wanted! Thanks, and thanks for writing it all in the first place. :-)
However, I haven't quite been able to get it to work fully. ... What am I doing wrong?
If you use pfesetup to create the project, prelude and library modules will be included as needed.
participants (2)
-
Durward McDonell -
Thomas Hallgren