Calling Python Code in Haskell

I have a bunch (or will have a bunch) of Python code that uses the OpenCV libraries as well as SimpleCV. I also have a bunch of Haskell code that does some other things, but wants to call one function that I define in Python. This one function returns a triple set of pairs.

What is the best way to use this feature in Haskell?

For example, a simplified example: if I have a function in Python

# foo.py import SimpleCV def foo(): return (1.0,2.0,3.0) 

I want to be able to do this in Haskell

 -- bar.hs main = do putStrLn $ show pyThingy.foo 

I tried using MissingPy ( http://hackage.haskell.org/package/MissingPy ), but whenever I try to import a local file, I just get

 *** Exception: <<MissingPy.Python.Types.PyException>> 

Thanks!

+4
source share
1 answer

You can use Thrift . For scalable development of cross-language services, it combines a software stack with a code generation mechanism to create services that work efficiently and smoothly between C ++, Java, Python , PHP, Ruby, Erlang, Perl, Haskell , C #, Cocoa, JavaScript , Node.js, Smalltalk, OCaml and Delphi and other languages.

+8
source