Skip to content
eyeinsky edited this page May 13, 2015 · 4 revisions

Graphmod

Graphmod is a tool for visualizing the dependencies between Haskell modules, using graphviz. You may download the most recent development version from here, or get a fairly recent version from hackage.

Examples

You may use --help to see a full list of options for the program. This Section provides some examples to give you a feel for how to use the program and to see what the output looks like.

The aeson library

The easiest way to visualize some module is to simply pass them on the command line. The flag -q suppresses the warnings about missing modules (e.g., due to uses of external libraries):

find Data -name '*.hs' | xargs graphmod -q | xdot -

The lens library

Many projects simply have too many dependencies between the modules, which makes the resulting graph too difficult to understand. By passing the -p flag, we instruct graphmod to prune some of the edges, so that we can get a feel for the overall dependencies between modules:

find src -name '*.hs' | xargs graphmod -q -p | xdot -

By default, modules in the same directory are clustered together. Sometimes, one gets a better visualization if the modules are not clustered; in that mode, we use color to indicate which modules reside in the same location.

find src -name '*.hs' | xargs graphmod -q -p --no-cluster | xdot -

More Examples

The modules in GHC's type-checker (pruned):

The modules in the Cryptol library (pruned; first image clustered, second unclustered)

Clone this wiki locally