Functional MetaPost

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

This entry was posted in haskell and tagged , , . Bookmark the permalink.

16 Responses to Functional MetaPost

  1. Felipe Lessa says:

    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.


    • Brent says:

      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. =)

      • Felipe Lessa says:

        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. =)

        • Brent says:

          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.

  2. Jared says:

    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).

  3. Janis Voigtlaender says:

    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?

    • Brent says:

      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? ;)

  4. JP Bernardy says:

    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?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s