intellij-haskforce icon indicating copy to clipboard operation
intellij-haskforce copied to clipboard

Support Eta

Open carymrobbins opened this issue 8 years ago • 9 comments

NOTE - Originally the JVM backend for GHC was named GHCVM. It has since been renamed to Eta.

There's a JVM backend being developed for GHC now - https://github.com/typelead/eta

@rahulmutt has requested that we try to provide basic ghcvm support in HaskForce -

The main requirements right now are basic syntax highlighting recognising some of the additions to the language. No Cabal or Stack yet - just directly compiling with the ghcvm command.

There's also the possibility of being able to reuse existing tooling fairly soon to simplify the requirements on HaskForce -

I realised a better solution to get a build tool quicker is to fork Cabal/cabal-install/Stack and add in the specific changes for ghcvm. I could also fork hlint, ghc-mod, etc. to use the GHCVM API instead of the GHC API. So in the first phase, the build tools will be platform-specific executables and later once we optimise GHCVM, we can compile those tools to JARs.

Huge props to @rahulmutt for bringing this all together. Hopefully we'll be able to use this opportunity to dog food HaskForce by writing parts of it in GHC Haskell.

In the meantime, let's use this ticket to discuss getting HaskForce into a state to provide basic GHCVM support.

carymrobbins avatar Sep 13 '16 04:09 carymrobbins

Here seems the description of the Java-FFI. This paragraph is especially interesting.

LeanderK avatar Sep 14 '16 20:09 LeanderK

Syntactic Additions

  • In foreign import java, java needs to be recognized and highlighted, just as ccall would in GHC.
  • In data {-# CLASS "java.lang.String" #} JString, CLASS needs to be recognized just as CTYPE would in GHC.

Interaction with EPM

  • For the configure step epm configure --with-java=[full-path-to-java] --with-javac=[full-path-to-javac] --with-eta=[full-path-to-eta]
  • The build, install, run steps will be the same replacing cabal with epm.

Those look like the basic changes you'll need for now. Let me know if you need anything else from my side.

rahulmutt avatar Sep 18 '16 12:09 rahulmutt

The latest master now parses the language additions that Eta introduces. See commit 92303c2d53a1256e59a2b4e098cdc01b9f2365d4 for details.

In order to properly support and build Eta projects, I'm proposing the following design.

  • [x] Parse and highlight Eta additions to the language
  • [x] New project wizard
    • Selecting Haskell should provide choices for GHC or Eta (JVM).
    • Choosing GHC should direct to the current Haskell wizard.
    • Choosing Eta should list the following fields -
      • Project name
      • Project location
      • Project SDK (enforce a Java SDK, NOT a Haskell SDK)
      • Path to Eta (inferred from PATH, default project, or blank)
      • Path to EPM (inferred just as above)
  • [ ] Eta Framework
    • Projects with a Java SDK and Haskell source files should be detected as potential Eta projects. We should then prompt for the paths to eta and epm.
  • [x] EPM Builder
    • Under Build Tools we should list EPM.
    • Here we should list the configured paths to eta and epm.
    • We might also want to provide the ability to configure the path to java and javac but have them defaulted to the Project JDK. A radio button could toggle between the Project JDK option and the manual path entry option.

@rahulmutt - Let me know if this makes sense to you or if you are expecting something different. I'll be working on these right away.

carymrobbins avatar Dec 05 '16 07:12 carymrobbins

@carymrobbins Great work! The changes you proposed make sense. For default paths to eta and epm, you can just search the PATH correct?

rahulmutt avatar Dec 05 '16 07:12 rahulmutt

Sort of, but IntelliJ is not aware of the PATH set in .bashrc or the like. See ExecUtil.locateExecutableByGuessing for how we make a best effort guess for the location of an executable.

carymrobbins avatar Dec 05 '16 07:12 carymrobbins

Sure sounds good.

rahulmutt avatar Dec 05 '16 07:12 rahulmutt

@carymrobbins What's the status of this issue?

rahulmutt avatar Jan 14 '17 04:01 rahulmutt

I've been wrapped up with working getting something out the door, so I haven't had as much time to get this done. In about a week things should slow down and I'll have more time.

Working out the EPM builder, you can see the commit history in 302-eta. I'll update this ticket when I get the builder done. Sorry for the delay!

carymrobbins avatar Jan 14 '17 17:01 carymrobbins

No problem! Just wanted to check the status.

rahulmutt avatar Jan 14 '17 17:01 rahulmutt