Haskell & Java/Scala interoperbility?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Haskell & Java/Scala interoperbility?

Vasili I. Galchin
Hello,

      I have been looking at Hackage for a package/library that
supports Haskell interoperability with Java/Scala. Didn't see any such
support. If true, is there any project in the works?

Thanks,

Vasili
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Haskell & Java/Scala interoperbility?

Ruben Astudillo
On 14/07/15 23:14, Vasili I. Galchin wrote:
> Hello,
>
>        I have been looking at Hackage for a package/library that
> supports Haskell interoperability with Java/Scala. Didn't see any such
> support. If true, is there any project in the works?

Frege [1] seems to be the go to option for something like haskell on the
JVM. Interoperation between GHC's haskell code and the JVM seems to be
not that easy.

[1]: https://github.com/Frege/frege

--
Ruben Astudillo                   OpenPGP: 0x3C332311
Crear un haiku, en diecisiete silabas, es complica...
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Haskell & Java/Scala interoperbility?

Vasili I. Galchin
Ruben,

      When you write "not that easy", is it because Frege is first compiled into Java vs directly calling the JVM??

Vasili

On Tuesday, July 14, 2015, Ruben Astudillo <[hidden email]> wrote:
On 14/07/15 23:14, Vasili I. Galchin wrote:
Hello,

       I have been looking at Hackage for a package/library that
supports Haskell interoperability with Java/Scala. Didn't see any such
support. If true, is there any project in the works?

Frege [1] seems to be the go to option for something like haskell on the
JVM. Interoperation between GHC's haskell code and the JVM seems to be
not that easy.

[1]: https://github.com/Frege/frege

--
Ruben Astudillo                   OpenPGP: 0x3C332311
Crear un haiku, en diecisiete silabas, es complica...

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Haskell & Java/Scala interoperbility?

Jason Dagit-3

On Tue, Jul 14, 2015 at 8:02 PM, Vasili I. Galchin <[hidden email]> wrote:
Ruben,

      When you write "not that easy", is it because Frege is first compiled into Java vs directly calling the JVM??

Vasili

On Tuesday, July 14, 2015, Ruben Astudillo <[hidden email]> wrote:
On 14/07/15 23:14, Vasili I. Galchin wrote:
Hello,

       I have been looking at Hackage for a package/library that
supports Haskell interoperability with Java/Scala. Didn't see any such
support. If true, is there any project in the works?

Frege [1] seems to be the go to option for something like haskell on the
JVM. Interoperation between GHC's haskell code and the JVM seems to be
not that easy.

[1]: https://github.com/Frege/frege

--
Ruben Astudillo                   OpenPGP: 0x3C332311
Crear un haiku, en diecisiete silabas, es complica...

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe



_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Haskell & Java/Scala interoperbility?

Vasili I. Galchin
In reply to this post by Vasili I. Galchin
I am looking to suppprt Haskell (OCaml ??) for apache.spark.org. Currently there is support for programming language "R" which has functional features (not as rich as Haskell, OCaml, et. al.) and does lazy evaluation. I am going to drop back and look at the R->Scala/Java implementation BUT I will also read your link.  Any more.suggestions are gratefully welcome.

Kind thx,

Vasili

On Tuesday, July 14, 2015, Jason Dagit <[hidden email]> wrote:
Did you look at java bridge?

Perhaps counter-intuitively, you're probably better off defining a protocol and using that for interop. Something like zeromq could simplify the communication.

The main hassle with a full interop is the difference between the notions of types in the two languages. For instance, subtyping on the Java side doesn't really map well to the Haskell side.

I would say that it forces attempts at a general interop to go with a least common denominator approach. In the extreme, this degenerates back to having the code on each side pretend like it's talking to C.

Whereas designing a message protocol for your task allows you to incorporate domain specific knowledge and thus avoid a general solution and also leave out things you will never use.

On Tue, Jul 14, 2015 at 7:14 PM, Vasili I. Galchin <<a href="javascript:_e(%7B%7D,&#39;cvml&#39;,&#39;vigalchin@gmail.com&#39;);" target="_blank">vigalchin@...> wrote:
Hello,

      I have been looking at Hackage for a package/library that
supports Haskell interoperability with Java/Scala. Didn't see any such
support. If true, is there any project in the works?

Thanks,

Vasili
_______________________________________________
Haskell-Cafe mailing list
<a href="javascript:_e(%7B%7D,&#39;cvml&#39;,&#39;Haskell-Cafe@haskell.org&#39;);" target="_blank">Haskell-Cafe@...
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe


_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Haskell & Java/Scala interoperbility?

Alexander Kjeldaas

I don't know of any project that does interopability, but I don't think there is any technical issues blocking this.  The GHC RTS and the JVM RTS should be able to run in the same process using their respective parts of the heap.  Initially you would want the set of threads managed by the JVM to be separate from the GHC RTS threads, but it might even be possible to have call directly from one to the other (through C).

Alexander


On Wed, Jul 15, 2015 at 5:13 AM, Vasili I. Galchin <[hidden email]> wrote:
I am looking to suppprt Haskell (OCaml ??) for apache.spark.org. Currently there is support for programming language "R" which has functional features (not as rich as Haskell, OCaml, et. al.) and does lazy evaluation. I am going to drop back and look at the R->Scala/Java implementation BUT I will also read your link.  Any more.suggestions are gratefully welcome.

Kind thx,

Vasili

On Tuesday, July 14, 2015, Jason Dagit <[hidden email]> wrote:
Did you look at java bridge?

Perhaps counter-intuitively, you're probably better off defining a protocol and using that for interop. Something like zeromq could simplify the communication.

The main hassle with a full interop is the difference between the notions of types in the two languages. For instance, subtyping on the Java side doesn't really map well to the Haskell side.

I would say that it forces attempts at a general interop to go with a least common denominator approach. In the extreme, this degenerates back to having the code on each side pretend like it's talking to C.

Whereas designing a message protocol for your task allows you to incorporate domain specific knowledge and thus avoid a general solution and also leave out things you will never use.

On Tue, Jul 14, 2015 at 7:14 PM, Vasili I. Galchin <[hidden email]> wrote:
Hello,

      I have been looking at Hackage for a package/library that
supports Haskell interoperability with Java/Scala. Didn't see any such
support. If true, is there any project in the works?

Thanks,

Vasili
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe


_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe



_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Haskell & Java/Scala interoperbility?

Patrick Chilton
In reply to this post by Vasili I. Galchin
I'm working on a Java binding generator as a side project that embeds the Java type system into Haskell quite well. Stay tuned!

On Wed, Jul 15, 2015 at 3:14 AM, Vasili I. Galchin <[hidden email]> wrote:
Hello,

      I have been looking at Hackage for a package/library that
supports Haskell interoperability with Java/Scala. Didn't see any such
support. If true, is there any project in the works?

Thanks,

Vasili
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe


_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Haskell & Java/Scala interoperbility?

Nikita Karetnikov
There's also a parser for Scala:
https://github.com/puffnfresh/language-scala

When I tried it (months ago), it couldn't parse scalac source, though.

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe

signature.asc (834 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Haskell & Java/Scala interoperbility?

Nikita Karetnikov
Oh, someone has mentioned Frege, but there's also Ermine:
https://github.com/ermine-language

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe

signature.asc (834 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Haskell & Java/Scala interoperbility?

John A. De Goes-2
In reply to this post by Vasili I. Galchin

This is a herculean effort due, among other things, to Spark’s heavy reliance on function serialization. Not to say you can’t do it, but it’s going to be a huge amount of effort to build and maintain it in any way that provides feature parity with any JVM language on Spark, and of course you’re going to be going Haskell -> C -> JVM, and JVM -> C -> Haskell for everything, which entails its own set of delightful pains.

If you’re not too picky about the ML, I’d suggest a better path is contributing to PureScript on the JVM (either that project or another one). PureScript’s semantics map cleanly to the JVM’s and very good native interop is possible; in addition, the PureScript compiler is designed for compiling to different backends (i.e. it has no runtime and will necessarily utilize the target’s native runtime environment).

One could ease Spark integration by targeting TASTY or generating functional code compatible with Scala / Java 8 runtimes.


-- 
John A. De Goes
Follow me @jdegoes

On July 14, 2015 at 9:13:05 PM, Vasili I. Galchin ([hidden email]) wrote:

I am looking to suppprt Haskell (OCaml ??) for apache.spark.org. Currently there is support for programming language "R" which has functional features (not as rich as Haskell, OCaml, et. al.) and does lazy evaluation. I am going to drop back and look at the R->Scala/Java implementation BUT I will also read your link.  Any more.suggestions are gratefully welcome.

Kind thx,

Vasili

On Tuesday, July 14, 2015, Jason Dagit <[hidden email]> wrote:
Did you look at java bridge?

Perhaps counter-intuitively, you're probably better off defining a protocol and using that for interop. Something like zeromq could simplify the communication.

The main hassle with a full interop is the difference between the notions of types in the two languages. For instance, subtyping on the Java side doesn't really map well to the Haskell side.

I would say that it forces attempts at a general interop to go with a least common denominator approach. In the extreme, this degenerates back to having the code on each side pretend like it's talking to C.

Whereas designing a message protocol for your task allows you to incorporate domain specific knowledge and thus avoid a general solution and also leave out things you will never use.

On Tue, Jul 14, 2015 at 7:14 PM, Vasili I. Galchin <<a href="javascript:_e(%7B%7D,'cvml','vigalchin@gmail.com');" target="_blank">vigalchin@...> wrote:
Hello,

      I have been looking at Hackage for a package/library that
supports Haskell interoperability with Java/Scala. Didn't see any such
support. If true, is there any project in the works?

Thanks,

Vasili
_______________________________________________
Haskell-Cafe mailing list
<a href="javascript:_e(%7B%7D,'cvml','Haskell-Cafe@haskell.org');" target="_blank">Haskell-Cafe@...
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe


_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Haskell & Java/Scala interoperbility?

Tom Ellis
On Wed, Jul 15, 2015 at 08:55:01AM -0600, John A. De Goes wrote:
> If you’re not too picky about the ML, I’d suggest a better path is
> contributing to PureScript on the JVM (either that project or another
> one).  PureScript’s semantics map cleanly to the JVM’s and very good
> native interop is possible; in addition, the PureScript compiler is
> designed for compiling to different backends (i.e.  it has no runtime and
> will necessarily utilize the target’s native runtime environment).

Could you explain why PureScript is easier to port to the JVM?  In
particular I don't understand why its "semantics map cleanly to the JVM’s"
but Haskell's don't.

Tom
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe