GHCVM has successfully accomplished the goals of Summer of Haskell:
- compile GHC 7.10.3's Haskell to Java bytecode
- access the vast Java ecosystem within Haskell
- port the base library
The initial proposal can be found here.
I had already been working for about a year on this project (primarily in the research phase, on and off) and I had just started programming the foundation of the runtime system when the applications period for HSoC was announced. I was determined to work on this project whether my proposal was accepted or not, but I was doubtful whether I would've been able to commit enough time during the summer to complete project on my own.
HSoC changed all of that. It allowed me to accomplish the following objectives:
- gave visibility for this project to the Haskell community
- boosted my motivation knowing that so many people were interested
- provided 3 months of funded, scheduled time that allowed me to devote all my energy to solving the problem at hand
- provided me support in the form of mentors (Edward Kmett & Tom Syd Kerchove) who were always there to help when needed
So at the end of the summer, what is an end user of GHCVM able to do? A user can run the following program:
-- Primes.hs
primes = filterPrime [2..]
where filterPrime (p:xs) =
p : filterPrime [x | x <- xs, x `mod` p /= 0]
-- Print out 101st prime
main = print $ primes !! 100
which can be compiled with
ghcvm -o Main.jar Primes.hs
This compiles to a standalone, cross-platform JAR file (~30MB size) that can be run directly on the JVM:
java -cp Main.jar ghcvm.main
I hope to release the first version of GHCVM 0.0.1 some time this week once a couple of minor bugs are ironed out, proper documentation is written on to highlight the key differences between GHC & GHCVM, and a sample tutorial is written on how to connect with Java.
I hope to continue to take this project forward seeing that is has come so far. The following is work to be done that can further increase GHCVM's usability on real projects:
- Finish implementing the stubbed out C FFI calls in base with Java FFI calls
- Port all the libraries that come bundled with GHC
- Port all the dependencies of Cabal & Stack for build system support
- Work on adding support for Template Haskell and an external interpreter
- Work on better concurrency support
- Optimize the generated bytecode