
Patrick LeBoutillier wrote:
Don,
Having painless Haskell <- Java interoperability would be great. I'm curious though: could it really be so simple as a one-line ``import foreign jvm'' directive? I imagine the purity mismatch between Haskell and Java would be very troublesome. No more so than C, surely. We're used to stateful APIs. They're a pain.
With this hypothetical ``import foreign jvm'' mechanism, what would the be type of imported Java stuff? Would it all be done in IO?
The more I think about it, the trickier it seems. Beside the purity mismatch of Haskell and Java, there is an OO/functional mismatch. That's more of an issue. But the prior work has been done.
Do you have any references to this work?
It was a major research topic about a decade ago, though the projects have died since. And the topic comes up about every 4 months on the Cafe, so I'd recommend sifting through the archives. I know last time it came up (or the time before?) I gave a rather extensive list of projects. And the wiki[1] still lists a few of them. The last time this discussion came up people got involved enough to revive LambdaVM[2], which was one of the more mature options back in the day. If you're interested in the topic, I suggest getting in touch with the author and helping out. On the topic of automatically embedding OO-style languages into Haskell, you should also check out hprotoc[3]. It's a package for Google's protocol buffers, which are ostensibly language agnostic but actually assume a (weakly) OO language. The hprotoc library will create a family of virtual modules based on the protocol spec and makes a pretty nice interface out of them. [1] http://www.haskell.org/haskellwiki/Applications_and_libraries/Interfacing_ot... [2] http://wiki.brianweb.net/LambdaVM/LambdaVM [3] http://hackage.haskell.org/package/hprotoc -- Live well, ~wren