I just spent a very frustrating hour trying to get the functional MetaPost library (a Haskell DSL for generating MetaPost) working. It installs (via cabal-install) without a hitch, but I haven’t been able to get it to actually work. I can write a test program which imports the FMP module, and compile it, but then when I try to run it, it spews out a gazillion .log, .tmp, .mpx, .aux… files and a nasty-looking series of error messages (including a segfault). I’m happy to provide more details if anyone thinks they would actually be able to help…
All the more motivation to get back to a rewrite of my diagrams library…
Why do you want to rewrite it? Do you have any ideas in mind? Perhaps I may be able to help you, as I like your library. The only complaint I have is not having a
> viewDiagram :: Diagram -> IO ()
that pops up a window allowing you to pan & zoom.
Thanks!
Perhaps “rewrite” is too strong a word; I want to move to a more flexible constraint-solving-based layout algorithm, which would allow for drawing lines/arrows/etc. between objects (the most glaring missing feature at the moment). But it might end up affecting a lot of the code which is why I said “rewrite”.
Having a ‘viewDiagram’ would be neat! I imagine it wouldn’t be too hard, just a matter of plugging in some sort of gtk2hs backend, although I don’t know anything about gtk2hs. I’m happy to accept patches, of course. =)
Hmmmm, yes, this seems worthwhile. Do you have any interfaces in mind? In a first thought it’s kinda hard to have a generic interface.
About the viewDiagram, yes, it shouldn’t be hard. Probably it could even be a separate package. In fact, I’ll probably need this function (or better, a widget and this function as a wrapper), so I’ll create a separate package when needed. =)
Yes, I have an interface in mind (with ideas mostly stolen/borrowed from MetaPost). The hardest part, I think, will be dealing with issues of naming and sharing, since I want to continue to use a deep embedding. But I have some ideas there too.
Have you looked at Asymptote? It may not do what you need on the Haskell end but I had luck using it to create diagrams. It might give you some ideas (3D).
I hadn’t heard of Asymptote; I’ll take a look at it. Thanks!
Not much help to you, but Functional MetaPost works very nicely for me. I don’t know about the installation problems, as I installed it looong ago, and never touched it since then (but running it often). Now I am almost afraid of having to install it on a new machine pretty soon.
Wouldn’t it be nice if Functional MP were part of the Haskell Platform?
Well, I’m glad it works for you!
That might be nice… although wouldn’t it be nicer if there were a native embedded Haskell drawing library which was part of the Platform? ;)
What I like about Functional MP is its seamless integration with TeX. It’s so easy to have native (la)tex stuff in one’s pictures, and the results directly fit back into my latex documents via .ps import as well.
But sure, a pure declarative drawing library is a good thing to have in any case.
Ah, very good point. As long as I’m rewriting my diagrams library, I should give some serious thought to (La)TeX integration. I don’t know how hard it would be to do.
Check out the PGF/TikZ library (http://www.ctan.org/tex-archive/graphics/pgf/base/doc/generic/pgf/pgfmanual.pdf); it integrates with LaTeX even better than Metapost. It could make a nice output format for the Diagrams library.
Ah, thanks for the pointer. I’ve heard of it but never really learned much about it. It could indeed make a nice output format!
I am guessing you had not installed metapost fully. You probably need to install a package called texlive-metapost. Any plans for a metapost backend for the diagrams library?
There are no particular plans, but a metapost backend could be nice. Out of curiosity, what features do you envision such a backend providing that other backends couldn’t?
I am interested in tex-typeset text within diagrams.
Ah, yes. I am interested in that too. Does http://hackage.haskell.org/package/diagrams-tikz do that? (I haven’t actually used it or looked at it carefully myself, but should take a look at it soon.)