Is it possible to create PHP extensions in Haskell? Is it possible to create PHP extensions in Haskell? php php

Is it possible to create PHP extensions in Haskell?


You can certainly do this, though I'm not sure anyone has tried. Haskell interoperates with C via its FFI mechanism, and you can certainly:

so if you can call C from PHP, and that C calls Haskell, you're in business.


Why would you want to do this? Faster, safer, simple code for your core algorithms or safety-critical code, perhaps. Or to take advantage of say, a parallel or multicore server backend via Haskell.


Yes, its possible. Just make sure you wrap everything and translate arguments between php -> c -> haskell and the way back correctly.