[Haskell-cafe] Re: Call Graph Tool?

Josef Svenningsson josef.svenningsson at gmail.com
Fri Jun 27 08:37:08 EDT 2008


On Fri, Jun 27, 2008 at 12:39 PM, Claus Reinke <claus.reinke at talk21.com> wrote:
>>> Assuming I get it included, is there any features in particular you'd
>>> want to
>>> see in there?  Note that if I do have it produce visualisations, they'll
>>> be
>>> static images as part of an analysis report rather than being
>>> interactive.
>>
>> I'd like the ability to show individual module dependencies, and then
>> to collapse modules in one package to just the package, so I could
>> "zoom out" and see how the packages relate to each other.  By
>> "package" here I mean the "A" in "A.B, A.C, etc."
>>
>> It seems like it would be fairly simple to use Language.Haskell.Parse
>> to turn a set of modules into a graph, and then something to massage
>> that and give it to dot.
>
> If you wanted to go down that route, try using 'ghc --make -v2'
> and translate that dependency graph to dot.
>
Yep, this is a pretty easy route and there is already a tool for doing
the translation: ocamldot. Don't be fooled by the name, it works on
Makefile's dependency information and in particular works well with
the output from ghc. Back in the days (like six years ago) I used it
on ghc itself. I also extended it so that different directories were
grouped together inside a box to get a better feel for the intended
structure of the program. ocamldot can be found here:
http://www.research.att.com/~trevor/ocamldot/

I should add that I didn't find the information the least bit helpful
so my general recommendation is to try to find some other method to
help understanding code.

All the best,

Josef


More information about the Haskell-Cafe mailing list