/python-calling-haskell-calling-python

A tiny proof-of-concept of writing a Haskell shared library that can be used from within a Python program, passing along Python callback functions that Haskell might invoke again at the appropriate time

Primary LanguagePython

First, make sure the dynamic library is up-to-date. Note that Ouroboros.so is a symlink in the main folder pointing to the output of cabal build. If the output of your cabal build puts the output elsewhere (because of differing ghc/cabal versions etc.), you might have to update the symlink.

cabal build

Now, run the example:

python example.py
  • Call Haskell from Python
  • Pass a Python callback function to a Haskell function, which Haskell will then call
  • Run Haskell in 'threaded' mode and have it do other things while running Python callbacks
  • Support the Python multiprocessing library ('just works'!)
  • Require only a single Ctrl+C to quit (currently requires two).