GHC then provides a runtime, written in C which is linked into your program. Haskell libraries often have C FFI bindings, especially the core libraries.
The work to port this to the JVM was:
Swapping “STG to Cmm” with “STG to JVM bytecode”
Porting GHC’s runtime to Java, while stubbing out some concurrency (for now)
Rewriting C FFI calls into Java FFI calls
Rahul Muttineni did 99% of this work and gave an awesome talk about what was involved:
How’s interop with Java? The examples I found were clean, but also very short, proof-of-concept. How’s integration with some random Java library? With environments like Android?
I’m not sure what has been tried with Android. I know Rahul wants to do some work for it. I don’t know if there’s anything currently stopping dx from translating from Eta’s .class output to .dx files.
I’ve worked a tiny bit on Eta, if anyone has questions.
Definitely! What type of work was involved in porting essentially all of Haskell’s syntax to the JVM?
GHC compiles through a few intermediate steps:
GHC then provides a runtime, written in C which is linked into your program. Haskell libraries often have C FFI bindings, especially the core libraries.
The work to port this to the JVM was:
Rahul Muttineni did 99% of this work and gave an awesome talk about what was involved:
https://youtu.be/CscBSNF6qnE
How’s interop with Java? The examples I found were clean, but also very short, proof-of-concept. How’s integration with some random Java library? With environments like Android?
You can see the FFI is capable of even subtyping:
https://github.com/typelead/eta-examples/blob/master/2-javafx/src/CalculatorApp.hs#L8-L9
Which is pretty impressive - though I would probably avoid being in a situation where that’s useful.
Here’s an example of writing a Minecraft mod:
http://ncrashed.github.io/blog/posts/2016-10-22-ghcvm-minecraft-modding.html
I’m not sure what has been tried with Android. I know Rahul wants to do some work for it. I don’t know if there’s anything currently stopping dx from translating from Eta’s .class output to .dx files.
The calculator example was removed in a commit, so the first link is dead; it can be found here.
[Comment removed by author]
It’s not lost as soon as you involve Java. It means you can use all of GHC’s extensions and most of Hackage.