Graphics output from Haskell as eps

Sarah Thompson
Mon, 17 Feb 2003 18:32:03 -0000

Hi all,

Has anyone done much work on outputting graphics in eps format directly from
Haskell? My intention is to be able to generate publication quality diagrams
for inclusion in TeX/LaTeX documents, without the size or quality penalties
of using bitmaps.

I want to write an automatic circuit visualisation utility somewhat
analogous to the AT&T GraphViz tools, but which generates circuit diagrams
that look 'right' to an electronic engineer (i.e. me). The idea is that a
raw netlist (effectively a directed graph) will be generated by some other
code, then fed into this tool, which will then generate a reasonably
understandable circuit diagram.

My most immediate requirement is to generate circuit diagrams, although
longer term I'll probably also want to be able to generate chip floor plan
diagrams too.

I'm not too bothered about higher level drawing primitives - just something
that can draw lines of appropriate widths and output text would be enough.

Has anyone done anything already, or should I just pull down the PDF specs
from Adobe and weigh in and write a library from scratch? If I do the
latter, will anyone be likely to want to use it also?


PS: To all who helped (esp. Sigbjorn Finne and Simon Peyton-Jones), the
in-memory SQL database I was working on did actually work very well in the
end. Unfortunately, my boss has insisted on a C++ rewrite - the C++ version
(using strict evaluation and STL data structures roughly modelled on the
Haskell version) is (I think, I've not measured this) a little slower, and
about 5 - 10 times the size. It's been extended a little beyond the Haskell
version, so it is difficult to be exact about the size difference, but gut
feeling is that it took about five times as much code and about three times
as long to write. And that's on the basis of someone who has over 10 years
experience coding C++, but very little prior exposure to Haskell beyond the
occasional recreational use. I think this proves Haskell's case as far as
I'm concerned - keep up the good work, folks!