intellij-haskforce
intellij-haskforce copied to clipboard
Support Eta
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.
Here seems the description of the Java-FFI. This paragraph is especially interesting.
Syntactic Additions
- In
foreign import java
,java
needs to be recognized and highlighted, just asccall
would in GHC. - In
data {-# CLASS "java.lang.String" #} JString
,CLASS
needs to be recognized just asCTYPE
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
withepm
.
Those look like the basic changes you'll need for now. Let me know if you need anything else from my side.
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
orEta (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)
- Selecting Haskell should provide choices for
- [ ] 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
andepm
.
- Projects with a Java SDK and Haskell source files should be detected as
potential Eta projects. We should then prompt for the paths to
- [x] EPM Builder
- Under Build Tools we should list EPM.
- Here we should list the configured paths to
eta
andepm
. - We might also want to provide the ability to configure the path to
java
andjavac
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 Great work! The changes you proposed make sense. For default paths to eta
and epm
, you can just search the PATH correct?
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.
Sure sounds good.
@carymrobbins What's the status of this issue?
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!
No problem! Just wanted to check the status.