Transpiler: Haskell -> OCaml, Rust, Scala?

Besides GitHub - tcr/corollary: Cross-compiler from Haskell to Rust, plus parser-haskell. is there any attempt at transpiling Haskell to OCaml / Rust / Scala ?

I’m aware that laziness semantics makes this difficult (i.e. generated code has infinite loops), but am wondering what attempts there are.

1 Like

GHC had a C backend at one point which got dropped. There is an LLVM backend but it doesn’t offer drastically better performance than the native code generator for intricate reasons.

Any Haskell compiler that doesn’t support GHC extensions isn’t gonna get much traction.

1 Like

It’s still there: 5.10.3. C Code Generator — Glasgow Haskell Compiler 9.6.1 User’s Guide, but you have to build a special version of GHC and it is not optimized for maximum performance.

2 Likes