Call Haskell functions from Python! HaPy is set of Haskell bindings for Python. Initially written in 2011 as a final project for Stanford's CS240H Haskell class by Ashwin Siripurapu, William Rowan, and David Fisher. Now rewritten mostly from scratch by David Fisher with different tradeoffs (gaining far more stability at the expense of initial setup).
Table of Contents
sudo apt-get install ghc-dynamic
.build-depends: [other haskell dependencies, if any], HaPy == 0.1.*
.extra-libraries: HSrts-ghc7.6.3
. IMPORTANT: You must update this line to refer to your current version of GHC. (This is slightly annoying, but I haven't been able to find a better way to do this.)example/haskell/Export.hs
.cabal sandbox init
.cabal install --enable-shared
.dist/dist-sandbox-*/build/
to your Python project directory.sudo pip install hapy-ffi
.from HaPy import HASKELL_MODULE_NAME
.cabal: Could not resolve dependencies
--> HaPy might not be in your local package index; run cabal update
and try again. If this doesn't help, the problem probably isn't HaPy related.Missing C library: HSrts-ghc7.8.2
(or similar) --> The version of the GHC RTS library that you specified in your cabal file doesn't match the version of GHC you're running.Symbol not found: _stg_IND_STATIC_info
or undefined symbol: stg_forkOnzh
--> The GHC RTS library isn't specified as one of the extra-libraries in the cabal file of your Haskell project. See the General Installation and Usage section above.None yet! Feel free to start an issue if there's something you don't understand.