Elixir 和 Haskell 互操作性

Elixir and Haskell interoperability

作为处理并发问题的平台,Elixir/OTP似乎是最合适的解决方案。

在编写带有 Web 界面的应用程序时,请考虑我想要使用另一种函数式语言(即 haskell)推理和解耦应用程序逻辑的情况(由于其高级检测等优点编译时的错误、静态类型等)。然后我会使用 GenServers 处理并发,并使用 Phoenix.Channels.

附加一个网络界面

这个设置甚至可以使用 NIFs 吗?另外,是否会保持真正的并发性?我不确定我在这里的推理是否正确,但是是否能够根据 GenServer 的要求生成一个新的 haskell 进程,并且两者是否能够有效地通信?

使用 NIF 和 GHC 的 FFI 以及少量样板 written in C. But NIFs are best used for short synchronous computations with no side effects 这种设置当然是可能的,我感觉这些操作不是这样的。

使用 C Nodes for the Haskell parts of the application. Most of the documentation you'll find for that will be for Erlang and not Elixir, but given Elixir's easy interop with Erlang, it should be pretty straight forward (someone's even written an example 可能会更好。大部分艰苦的工作将与编写 Haskell "C Node" 有关,粗略地浏览一下 hackage 和 github 什么也找不到。