Question

What are current solutions to Haskell/Java interop? I've seen the paper on Lambada by Meijer and Finne. There is a project called GCJNI, but it seems to be defunct -- links to it are broken. Is there something that one could use out of the box?

Was it helpful?

Solution

Using the GHC FFI you can create a shared library that exports functions from Haskell land, that Java can then use via JNA. Alternatively you can take this same shared library and write some glue code to expose it through JNI for a more "Java-y" interface. You could also go nuts and expose enough of JNI through the FFI to Haskell to really get your Java on (This is somewhat the approach the Lambada paper takes).

I believe the Haskell shared lib + JNA would be the simplest, easiest approach. This is assuming that it's easier to expose some Haskell functions to Java, than it is to expose some Java objects to Haskell. For some insight in going the other direction, you may be interested in Salsa, which is C#, not Java but the principles in designing the interfaces may be of interest.

OTHER TIPS

Not really an interop, but you could use http rest or zeromq

http://www.zeromq.org/

haskell bindings: http://www.zeromq.org/bindings:haskell

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top