[Haskell-cafe] analyzing modules import/export

2008-09-03 Thread Han Joosten

I am currently involved with a Haskell project to create a toolset for a
formal language. The toolset contains a parser, a typechecker and s range of
other features. 
The Haskell code currently consists of about 20 modules. I am new in the
project, and my impression is that a lot of code does not reside in the
proper module. I would like to be able to get a good feeling in how the
modules are structured, and how they are consumed by other modules. This
would enable me to clean up a little bit. 
I use eclipsefp. Do you know of any way to get insight of the structure of
modules? is any tooling available?
Any suggestions would help a lot! Thanx for reading. 

Han Joosten

-- 
View this message in context: 
http://www.nabble.com/analyzing-modules-import-export-tp19297359p19297359.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] analyzing modules import/export

2008-09-03 Thread Don Stewart
j.m.m.joosten:
 
 I am currently involved with a Haskell project to create a toolset for a
 formal language. The toolset contains a parser, a typechecker and s range of
 other features. 

 The Haskell code currently consists of about 20 modules. I am new in
 the project, and my impression is that a lot of code does not reside
 in the proper module. I would like to be able to get a good feeling in
 how the modules are structured, and how they are consumed by other
 modules. This would enable me to clean up a little bit. 

 I use eclipsefp. Do you know of any way to get insight of the
 structure of modules? is any tooling available?  Any suggestions would
 help a lot! Thanx for reading. 

There's been a few projects at Galois for this kind of high level
structural analysis. We're trying to polish them up into a release. 

For now, there's one tool you can get started with: graphmod.

This tool was written by Andy Gill (the dotgen part) and Iavor Diatchki
(the graphmod part),  and you can use it like so:

$ git clone http://code.haskell.org/graphmod.git
$ cd graphmod

-- build dotgen
$ cd dotgen
.. edit the .cabal file to add the line:
Build-type:  Simple
   after the Exposed-modules line
$ cabal install

-- build graphmod
$ cd ..
$ cabal install
...
Installing: /home/dons/.cabal/bin

Now you have 'graphmod' a tool for drawing the module structure. 
So go find a project, and analyze it:

$ cd ~/xmonad

-- generate module graph
$ graphmod XMonad XMonad.hs Main.hs  /tmp/xmonad.dot

-- generate svg of graph
$ dot -Tsvg /tmp/xmonad.dot  xmonad.svg

Which gives this result:

http://galois.com/~dons/images/xmonad.svg

Enjoy!

-- Don
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe