5

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 stuff, but wants to call one function that I define in the Python. This one function returns a three-tuple of doubles.

What's the best way to go about calling this function in Haskell?

For instance, a simplified case is 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've tried using MissingPy (http://hackage.haskell.org/package/MissingPy), but whenever I try to import the local file I just get

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

Thanks!

asked Jan 13, 2013 at 15:07

1 Answer 1

7

You can use Thrift. It's for scalable cross-language services development, combines a software stack with a code generation engine to build services that work efficiently and seamlessly between C++, Java, Python, PHP, Ruby, Erlang, Perl, Haskell, C#, Cocoa, JavaScript, Node.js, Smalltalk, OCaml and Delphi and other languages.

answered Jan 13, 2013 at 15:16
Sign up to request clarification or add additional context in comments.

1 Comment

Works perfectly - had to wrestle with it a little bit (stupid broken packages on my system T_T) but now it works! Hooray!

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.