Announce: hs2dot 0.1.1 - generate graphviz code by analyzing Haskell source code files

Hi, I've just released hs2dot on hackagedb. It's a small tool that lets you automatically generate graphviz/dot code that visualize the relations between data types, types and type classes. Example usage:
hs2dot Hack.hs | dot -T pdf -o Hack.pdf
Multiple files can be analyzed together as in
hs2dot Foo.hs Bar.hs | dot -T png -o FooBar.png
so their data types can point to each other. Example diagrams generated using h2dot can be found at http://github.com/finnsson/hs2graphviz/tree/master/Examples/ Examples of real code analyzed: http://github.com/finnsson/hs2graphviz/raw/master/Examples/Control.pdf (from hpage) http://github.com/finnsson/hs2graphviz/raw/master/Examples/Hack.png (from Hack) Example of mock code analyzed: http://github.com/finnsson/hs2graphviz/raw/master/Examples/TestCode.pdf (three files analyzed together) The tool is still far from complete. Better handling of algebraic data types and instance declarations are a must. GADTs, data families and type synonym families are not yet implemented so they wont turn up. -- Oscar

Oscar Finnsson
Hi,
I've just released hs2dot on hackagedb.
It's a small tool that lets you automatically generate graphviz/dot code that visualize the relations between data types, types and type classes.
This sounds very familiar to my SourceGraph package that's already on Hackage... You, however, also add the type signatures to your graph; I have the sneaking suspicion that this could get too noisy if you also try to visualise functions in a large module.
The tool is still far from complete. Better handling of algebraic data types and instance declarations are a must. GADTs, data families and type synonym families are not yet implemented so they wont turn up.
I, too, still haven't worked out how to deal with GADTs, etc. in my call graphs. -- Ivan Lazar Miljenovic Ivan.Miljenovic@gmail.com IvanMiljenovic.wordpress.com

It's a small tool that lets you automatically generate graphviz/dot code that visualize the relations between data types, types and type classes.
This sounds very familiar to my SourceGraph package that's already on Hackage...
I hope that some friendly competition can spur both of us to deliver even better tooling :)
You, however, also add the type signatures to your graph; I have the sneaking suspicion that this could get too noisy if you also try to visualise functions in a large module.
Visualizing every aspect is probably never a good idea. At the moment I'm sketching on alternative visualizations where only relations between modules show up or where the data constructors for data types aren't visualized. On a related note: has anyone yet tried to visualize the flow of the IO monad in an application? -- Oscar

On a related note: has anyone yet tried to visualize the flow of the IO monad in an application?
You mean a control flow graph?
Exactly. In (most) other programming languages it would be impossible for a tool to automatically know which flow to concentrate on/visualize but in Haskell it should be at least theoretically possible to inspect a package/module and trace the IO monad (beginning in main for an executable) in the code and visualize it as a control flow graph. I think it would probably be a great tool that would help one to inspect the architecture. -- Oscar
participants (2)
-
Ivan Lazar Miljenovic
-
Oscar Finnsson