[Haskell-cafe] Haskell and Java

Andy Smith andy.haskell at zambezi.org.uk
Wed Sep 10 02:47:45 EDT 2008

2008/9/9 Maurí­cio <briqueabraque at yahoo.com>:
> I use Haskell, and my friends at
> work use Java. Do you think it
> could be a good idea to use Haskell
> with Java, so I could understand
> and cooperate with them? Is there a
> a Haskell to Java compiler that's
> already ready to use?

Besides the other approaches people have suggested, maybe you could
use a combination of the Haskell FFI and JNI (Java Native Interface)
or JNA (Java Native Access). I have no idea how practical this would
be, and it would only work on platforms where you can compile Haskell
to native code rather than on any JVM, but if that's OK it might be
worth exploring.

If you want to call Haskell functions from Java, it seems to me it
should be possible to write FFI export declarations for the Haskell
functions you want to use from Java, and write a C wrapper to package
the exported functions for JNI as if they were native C functions.
With JNA you might be able to avoid writing a C wrapper, although I
know even less about JNA than I do about JNI. It should also be
possible to go the other way if you want to call Java code from
Haskell, at least with JNI but possibly not with JNA.


More information about the Haskell-Cafe mailing list