Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Haskell Java Interoperability

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?

like image 448
Bartosz Milewski Avatar asked Mar 10 '12 21:03

Bartosz Milewski


2 Answers

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.

like image 175
Logan Capaldo Avatar answered Oct 05 '22 07:10

Logan Capaldo


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

http://www.zeromq.org/

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

like image 38
Vagif Verdi Avatar answered Oct 05 '22 06:10

Vagif Verdi