Release 0.2.1 of Haskell/Java VM Bridge is now available in source-code form.
0.2.1 is a minimal update to work with GHC 6.0. If you are using GHC 5.04, you should use the 0.2 release instead.
Haskell/Java VM Bridge allows Haskell programs access to the Java Virtual Machine. It comes in two parts: the 'Native' part, that abstracts away differences in the various Java VMs, and the 'Haskell' part that provides a Haskell API. The Native part is not Haskell-specific, and could potentially be used by other languages wishing to access the Java VM.
* Calling of Java methods, access to fields, array-handling;
* Integration of garbage collectors;
* Reconciliation of exception models;
* Reconciliation of thread models, including 'synchronized' monitor support and the ability to fork Haskell actions as Java threads;
* Strong typing for Java classes and method argument lists (as tuples), and use of Haskell lists as arrays;
* Creation of Java classes 'on the fly' (using DefineClass and the Java Class File Format) that can have Haskell callback methods;
* Lifted monads which do all the necessary JNI class and method/field ID preloading and 'JNIEnv'-pointer variable handling for you -- these can be automatically generated via a tool (MakeJVMModule);
* Layered design includes lower-level IO-based interface;
* Automatic generation of modules for Java API classes;
* All relevant imports, flags and libraries etc. handled by a single GHC package 'javavm';
* No 'unsafe' Haskell calls or pure function FFI anywhere;
* Easy to port to new Java VMs.
This release should be 'beta' quality, but has undergone little testing.
You will need:
* An x86 machine running some form of Unix, or a Mac OS X machine;
* GHC 6.0 or later;
* A Java VM. It's been tested only with Sun's JVM, but should (may?) work with a number of others.
Haddock documentation is currently blocked on a bug in Haddock ("implicit parameters"). Should that be fixed, you will be able to build API documentaion by doing "make doc".
Some simple examples have been included such as a program that shows a Java Frame containing an instance of a Haskell-defined subclass of Canvas that has a Haskell 'paint' method that draws an oval. You should be able to figure out most of it from that.
Haskell/JVM Bridge and source code is licensed under the GNU Lesser GPL.
* port to Cygwin
* use hierarchical module structure
* separate out pure (non-FFI) Haskell into a separate package
* better typing for the IO-based layer