[Haskell-cafe] ANNOUNCE: graphtype — A simple tool to illustrate dependencies between Haskell types

2009-08-24 Thread Max Desyatov

While developing applications which deal with complex data it is crucial
to know how exactly you manipulate this data.  Haskell provides excellent
tools for expressing a data scheme you work with: ADTs, `type` and `newtype`
declarations, type classes and much more is hidden in rich Haskell's
type system.  Obviously, when types of data in your domain you work with
grow — all declarations grow, and it becomes hard to grasp all
dependencies, to change them and to remove them deliberately.

graphtype was developed to visualise type declarations in you Haskell
source files.  It produces .dot-file for subsequent processing with
graphviz.

Results for example file bundled with graphtype:
http://i.piccy.info/i4/00/90/bfa07290012c2d3b455696bdaa86.png

To play with it, you can use hackage: 
http://hackage.haskell.org/package/graphtype
or hack some code: http://github.com/explicitcall/graphtype

Visualisation of dependencies in complex type class hierarchies is still
on the way.  It isn't obvious how do to this nicely, as in most cases
type class declarations are imported from other libraries, and you don't
always have source files for them.

Anyway, graphtype is fairly usable.  Leave here your questions,
suggestions and have fun looking at type dependencies in your code.

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


Re: [Haskell-cafe] ANNOUNCE: graphtype — A simple tool to illustrate dependencies between Haskell types

2009-08-24 Thread Bernie Pope
2009/8/24 Max Desyatov explicitc...@googlemail.com:

 graphtype was developed to visualise type declarations in you Haskell
 source files.  It produces .dot-file for subsequent processing with
 graphviz.

 Anyway, graphtype is fairly usable.  Leave here your questions,
 suggestions and have fun looking at type dependencies in your code.

Neat.

You could probably get some leverage from the GHC API for reading .hi
files to find out information about imported types.

It looks to me like you generate one image file for the whole graph.
It could get quite big. I think dot supports hyperlinks, and so do
some image formats (SVG I believe). Maybe you could split it up into
pieces with hyperlinks between them. Browser support for SVG appears
to be getting better these days.

I've sometimes mused about the idea of graphing the static function
call graph of programs and annotating arcs with type information. For
that the GHC API would be the way to go (might need to do a little
type reconstruction along the way to figure out the concrete types at
which polymorphic functions are used.)

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