H2JVM – A Haskell Library for Writing JVM Bytecode(discourse.haskell.org) |
H2JVM – A Haskell Library for Writing JVM Bytecode(discourse.haskell.org) |
var foo = expr ? new Foo() : new Bar();
For such an expression, some superclass or superinterface for both Foo and Bar has to be chosen.What I am curios about is, if the java classfile API[1] provides a good model that could work in Haskell as well - I always had the impression that it was heavily influenced by functional programming, for example it uses "lifting transforms"[2].
PS: Good work on the label resolving part - this model is also used by the Java Classfile API and before it, ASM.
[1]: https://docs.oracle.com/en/java/javase/26/docs/api/java.base... [2]: https://docs.oracle.com/en/java/javase/26/docs/api/java.base...
I (kinda) get why someone might want to write Haskell rather than Java, but I'm just not sure why you would want to run Haskell on the JVM?
You get lots of things for free when targeting JVM bytecode. GCs, JITs, interop with one of the largest and most battle tested ecosystems.
Frege targets Java source code, which is then compiled by javac - the downside of that approach is you can not preserve the line numbers for debug information.