Best way to call Haskell functions from within Java

后端 未结 4 862
孤街浪徒
孤街浪徒 2020-12-08 20:14

I\'m looking an efficient way of executing Haskell functions from within a Java program. I\'ve considered the use of exec() to interact with GHC, but it seems like there sho

4条回答
  •  执笔经年
    2020-12-08 20:57

    I usually avoid JNI-type approaches to linking across runtimes/languages. They just have too many gotchas and little upside. I find it easier to work across process boundaries. While I've never tried it with Haskell and Java, they both have libraries that support XML RPC, and it sounds like a natural fit for what you're doing. So: set up a Haskell program as a "service" and just call its functions when you need them.

提交回复
热议问题