Calling Haskell from Python / C++

Jonathan Holt
Tue, 12 Nov 2002 09:23:31 -0800 (PST)


I've just recently learned about Haskell, and I'm
impressed by the abstractions and expressiveness that
it affords. I'm particularly interested in it for a
small parser project that I'm planning.

However, my main programming languages are Python and
C++, and for various reasons switching entirely to
Haskell is completely out of the question (no
flame-bait intended!).

So here is what I envision: I write the main
application in Python. I write a (hopefully) small
Haskell module that:
a) Calls back to the main Python app for reading the
text to be parsed, preferably using laziness.
b) Parses the text, and maybe processes a bit.
c) Returns the parsed data-structure. (This may be
tricky, but I think I know how to do it).

This all seems quite cool. And it can also be very
useful in a wide veriety of other circumstances, i.e.
whenever a complex computation can be "outsourced"
from Python/C++ to Haskell.

But I can't find any way to interface Python and
Haskell in this way. The FFI seems to allow for this,
but there arn't any tools to actually do it... So my
question is: How would one do such a thing?

Thanks in advance,

Do you Yahoo!?
U2 on LAUNCH - Exclusive greatest hits videos