[Haskell-cafe] Talking to Java from Haskell?

sterl s.clover at gmail.com
Fri Jul 9 00:11:11 EDT 2010


Daniel Cook wrote:
> b) Wrap the Java library with some code to use a lightweight message
> queue (zeromq) to send messages to my Haskell program?  (This would
> require essentially re-implementing an abstracted subset of the the
> protocol into 0MQ messages)
A simpler solution might be Facebook's thrift [1] (now an Apache 
project). You write a simple file in a C-inspired IDL which gives 
typedefs and RPC signatures, and not only do you get the data structures 
and serialization functions in a number of target languages including 
Haskell and Java, but you get lightweight, relatively robust, server and 
client implementations. The implementations of the Java functions can 
then be written in Scala or Clojure, so you avoid having to leave 
fp-land entirely. One could even run the Java binary directly from 
Haskell using System.Process and friends, and rather than communicating 
over ports, communicate over pipes. In any case, I've had good luck with 
this approach.

Cheers,
Sterl.

[1] http://incubator.apache.org/thrift/


More information about the Haskell-Cafe mailing list