The best way to call Java from Haskell?

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

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
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@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

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
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
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@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

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
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
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
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@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- JP Moresmau http://jpmoresmau.blogspot.com/

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-exe...
On Tue, Oct 11, 2011 at 8:15 AM, JP Moresmau
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
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
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
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@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- JP Moresmau http://jpmoresmau.blogspot.com/
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Maybe your Haskell code could be compiled with only minor
modifications on something like CAL or Frege? There seems to be some
interest in them these days, so maybe a translator is on its way...
JP
On Tue, Oct 11, 2011 at 8:23 AM, Michael Snoyman
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-exe...
On Tue, Oct 11, 2011 at 8:15 AM, JP Moresmau
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
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
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
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@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- JP Moresmau http://jpmoresmau.blogspot.com/
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- JP Moresmau http://jpmoresmau.blogspot.com/

On Tue, Oct 11, 2011 at 8:34 AM, JP Moresmau
Maybe your Haskell code could be compiled with only minor modifications on something like CAL or Frege? There seems to be some interest in them these days, so maybe a translator is on its way...
Likely not. xml-enumerator relies on attoparsec-text and blaze-builder, neither of which I'd imagine will work easily on either CAL or Frege. And xml-hamlet uses quasi-quotation, which almost certainly wouldn't work. I could likely change it from real QQ to some kind of preprocessor without too much effort, but I think overall it's a losing venture. Michael

On 10/11/11 08:23 AM, Michael Snoyman wrote:
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.
LambdaVM do exactly what you like, but is experimental and unfortunately out-dated. It's based on pre ghc 6.8: $ ./compiler/stage1/ghc-inplace --version The Glorious Glasgow Haskell Compilation System, version 6.7.20081028 anyway, for hello world like examples it's working well, although benchmarking shows that it's slower on the same code then frege for example (testing just naive fib to compare recursion speed) I've contacted author several times and asked for updating or help with updating it to latest GHC HEAD but received no reply so far and unfortunately my Haskell knowledge is kind of enough to write just this hello world... Karel

On Tue, Oct 11, 2011 at 8:53 AM, Karel Gardas
On 10/11/11 08:23 AM, Michael Snoyman wrote:
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.
LambdaVM do exactly what you like, but is experimental and unfortunately out-dated. It's based on pre ghc 6.8:
$ ./compiler/stage1/ghc-inplace --version The Glorious Glasgow Haskell Compilation System, version 6.7.20081028
anyway, for hello world like examples it's working well, although benchmarking shows that it's slower on the same code then frege for example (testing just naive fib to compare recursion speed)
I've contacted author several times and asked for updating or help with updating it to latest GHC HEAD but received no reply so far and unfortunately my Haskell knowledge is kind of enough to write just this hello world...
Karel
Yes, I really wish LambdaVM were alive and kicking. I've never actually hacked on GHC itself, but this might be the impetus to get me started. I might have some time to look at this in more depth a few months from now. Michael

Dmitri wrote:
I need to call Stanford NLP Parser from Haskell (unfortunately Haskell does not have a similar one)...
Just out of curiosity, why do you not consider GF at all similar? To an outsider like me, there does appear to be quite a bit of similarity. http://www.grammaticalframework.org/ Thanks, Yitz

On Tue, Oct 11, 2011 at 12:42 PM, Yitzchak Gale
Dmitri wrote:
I need to call Stanford NLP Parser from Haskell (unfortunately Haskell does not have a similar one)...
Just out of curiosity, why do you not consider GF at all similar? To an outsider like me, there does appear to be quite a bit of similarity.
http://www.grammaticalframework.org/
Thanks, Yitz
As I understand GF is well suited for parsing well defined formal languages. Not sure that GF can be used as NLP parser for blog messages that I need. Please correct me if I am wrong. As a general note, Java has tons of useful libraries that will take infinite time to re-implement in Haskell. To my mind it makes a lot of sense to have a reliable mechanism to call Java from Haskell. BTW, yet another way to do this: wrap Java library in RESTFUL web service ) -- All the best, Dmitri O. Kondratiev "This is what keeps me going: discovery" dokondr@gmail.com http://sites.google.com/site/dokondr/welcome

On Tue, Oct 11, 2011 at 5:56 AM, dokondr
useful libraries that will take infinite time to re-implement in Haskell ^^^^^^^^
My brain just exploded. I can't handle infinite-length modules. In the e-mail thread The best way to call Java from Haskell? In the mailing list: haskell-cafe -- Felipe.

Felipe Almeida Lessa cites and comments:
useful libraries that will take infinite time to re-implement in Haskell ^^^^^^^^
My brain just exploded. I can't handle infinite-length modules.
Don't worry, my friend. Haskell is lazy, so there is no problem in "handling" those infinite modules. It will just take you an anfinite amount of time before you get any money from such a work. But this is a general problem elsewhere as well. Jerzy Karczmarczuk

Jerzy Karczmarczuk
Don't worry, my friend. Haskell is lazy, so there is no problem in "handling" those infinite modules. It will just take you an infinite amount of time before you get any money from such a work. But this is a general problem elsewhere as well.
I guess you must be thinking of Haskell being increasingly used in banks? It must have been some bank manager who, after hiring one too many Haskell programmers, invented a scheme that would generate an infinite amount of money. He didn't realize before it was too late that the actual value of the scheme would be bottom... -k -- If I haven't seen further, it is by standing in the footprints of giants

On Tue, Oct 11, 2011 at 1:56 AM, dokondr
On Tue, Oct 11, 2011 at 12:42 PM, Yitzchak Gale
wrote: Just out of curiosity, why do you not consider GF at all similar? To an outsider like me, there does appear to be quite a bit of similarity.
As I understand GF is well suited for parsing well defined formal languages. Not sure that GF can be used as NLP parser for blog messages that I need.
That is correct - more or less. GF is a very expressive language, and it can handle a great deal of natural language, but it /does/ require that the input be grammatically correct, and it is difficult to work in unexpected vocabulary. GF is fantastic for making flexible Controlled Natural Languages, and it excels at producing human-readable text, but it is an entirely different beast from a statistical natural language parser, such as Stanford's. re: the original question -- The best method I've found for interfacing Haskell / Java for NLP is to share data with some common format, such as UIMAs CAS serialization. We really ought to start up a group of people interested in that over on the Haskell NLP list and see what we have if we pool all our efforts. --Rogan
Please correct me if I am wrong. As a general note, Java has tons of useful libraries that will take infinite time to re-implement in Haskell. To my mind it makes a lot of sense to have a reliable mechanism to call Java from Haskell. BTW, yet another way to do this: wrap Java library in RESTFUL web service ) -- All the best, Dmitri O. Kondratiev
"This is what keeps me going: discovery" dokondr@gmail.com http://sites.google.com/site/dokondr/welcome
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
participants (11)
-
Aatch
-
Claude Lee
-
dokondr
-
Felipe Almeida Lessa
-
Jerzy Karczmarczuk
-
JP Moresmau
-
Karel Gardas
-
Ketil Malde
-
Michael Snoyman
-
Rogan Creswick
-
Yitzchak Gale