Calling Haskell from Python / C++

Keith Wansbrough
Thu, 14 Nov 2002 17:17:49 +0000

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

You might be able to get away with running the Haskell program as a separate process, communicating via pipes.  Look at Posix.popen (not available in the new libraries yet):

This is probably easier to achieve than trying to link the programs together, but it does limit you to bytestream communication both ways.

--KW 8-)
Keith Wansbrough <>
University of Cambridge Computer Laboratory.