[Haskell-cafe] The best way to call Java from Haskell?

Michael Snoyman michael at snoyman.com
Tue Oct 11 08:23:55 CEST 2011


Perhaps my needs are unique here, but I thought I'd mention them
anyway. The main tool we use at work is based on a hodge-podge of
Java, Ant and XSLT code[1]. This thing has to be constantly extended
to support new functionality (or fix one of its myriad bugs), and
there's no technical hurdle to using Haskell to that end. In fact, my
company has released a few packages[2][3][4] specifically in this
venture.

There are two problems, however:

* Some clients have an insistence that code run on the JVM.
* It's inconvenient having multiple executables. Additionally, I've
run into some problems in the past deploying to ancient Linux
servers[5].

So for my use case, I don't care at all about interacting with Java
code, I simply want to be able to turn my existing Haskell code into a
JAR file. This seems like a much simpler undertaking, but I'm still
not aware of any way to get this to happen right now either.

Michael

[1] http://dita-ot.sourceforge.net/
[2] http://hackage.haskell.org/package/xml-enumerator
[3] http://hackage.haskell.org/package/xml-hamlet
[4] http://hackage.haskell.org/package/uri-enumerator
[5] http://stackoverflow.com/questions/5953199/create-a-static-haskell-linux-executable

On Tue, Oct 11, 2011 at 8:15 AM, JP Moresmau <jpmoresmau at gmail.com> wrote:
> I had started a project to start a JVM and call Java code from
> Haskell, but got sidetracked into EclipseFP, but I hope to go back to
> it someday.
> https://github.com/JPMoresmau/HJVM. Have a look at the test suite for
> some examples.
>
> Hope this helps
>
> JP
>
> On Tue, Oct 11, 2011 at 7:20 AM, Aatch <bladeon at gmail.com> wrote:
>> There are some projects to try and provide a bridge between Haskell
>> and the JVM. Unfortunately none of the seem to have much development.
>> As it stands, there is GCJNI, which allows Haskell to invoke Java
>> code, seems like a Java version of hsc2hs, but the site is down, it
>> just 404s. There is also haskell-jvm-bridge, but that doesn't look
>> like it has any development for about 18 months, and there isn't much
>> about it. Then there is LambdaVM, which looks the most promising, as
>> it compiles GHC byte-code to JVM bytecode. However, it doesn't look it
>> has been updated in a few years.
>> You can try your luck with any of those, but currently, if you want a
>> decent FFI for Java, you're probably going to have to resurrect one of
>> those projects.
>>
>> ---
>> James Miller
>>
>>
>>
>> On 11 October 2011 15:26, Claude Lee <calee2005 at gmail.com> wrote:
>>> Hi,
>>>
>>> vote+1.
>>>
>>> Theoretically, you can bridge Haskell and Java with FFI. It applys to small
>>> projects. Larger ones may need some build tools...
>>>
>>> Claude
>>>
>>> 2011/10/11 dokondr <dokondr at gmail.com>
>>>>
>>>> Hi,
>>>> I need to call Stanford NLP Parser from Haskell (unfortunately Haskell
>>>> does not have a similar one):
>>>> http://nlp.stanford.edu/software/lex-parser.shtml
>>>>
>>>> What would be the most reliable framework for this?
>>>>
>>>> Thanks!
>>>> Dmitri
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Haskell-Cafe mailing list
>>>> Haskell-Cafe at haskell.org
>>>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>>>
>>>
>>>
>>> _______________________________________________
>>> Haskell-Cafe mailing list
>>> Haskell-Cafe at haskell.org
>>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>>
>>>
>>
>> _______________________________________________
>> Haskell-Cafe mailing list
>> Haskell-Cafe at haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>
>
>
>
> --
> JP Moresmau
> http://jpmoresmau.blogspot.com/
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>



More information about the Haskell-Cafe mailing list