1. 11

  2. 5

    I’ve worked a tiny bit on Eta, if anyone has questions.

    1. 3

      Definitely! What type of work was involved in porting essentially all of Haskell’s syntax to the JVM?

      1. 8

        GHC compiles through a few intermediate steps:

        1. Haskell source to GHC Core
        2. GHC Core to STG
        3. STG to Cmm
        4. Cmm to assembly

        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:

        1. Swapping “STG to Cmm” with “STG to JVM bytecode”
        2. Porting GHC’s runtime to Java, while stubbing out some concurrency (for now)
        3. Rewriting C FFI calls into Java FFI calls

        Rahul Muttineni did 99% of this work and gave an awesome talk about what was involved:


      2. 3

        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?

        1. 5

          You can see the FFI is capable of even subtyping:


          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:


          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.

          1. 2

            The calculator example was removed in a commit, so the first link is dead; it can be found here.

      3. 2

        Sorry for the obvious question. How is this different from Frege? It seems like it has compatibility with GHC, which is nice, but that would be lost as soon as you involve Java.

        1. 4

          It’s not lost as soon as you involve Java. It means you can use all of GHC’s extensions and most of Hackage.

          1. 3

            I get it. Thanks for taking the time to answer my silly question instead of downvoting.