haskell - 在 IO 中运行分布式进程的 Process 类型

标签 haskell distributed

我正在尝试从 distributed-process 运行 channelsDemo文档,但是当我尝试从 main 运行 channelsDemo 时,如下所示:

main = channelsDemo

我收到以下错误:

Couldn't match expected type IO () with actual type Process ()

这是channelsDemo函数:

channelsDemo :: Process ()
channelsDemo = do
    (sp, rp) <- newChan :: Process (SendPort String, ReceivePort String)

    -- send on a channel
    spawnLocal $ sendChan sp "hello!"

    -- receive on a channel
    m <- receiveChan rp
    say $ show m

我发现了问题,但不知道如何解决。

最佳答案

分布式进程有一个 runProcess函数似乎具有正确的签名:

runProcess :: LocalNode -> Process () -> IO ()

还有一种方法可以创建 LocalNode:

newLocalNode :: Transport -> RemoteTable -> IO LocalNode

关于haskell - 在 IO 中运行分布式进程的 Process 类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36475480/

相关文章:

haskell - Emacs 在 haskell 模式下挂起,并调用了 lower-haskell-load-file

haskell - 如何将数据元素映射到数据类型

c++ - 开发在桌面和浏览器中运行的应用程序的最佳技术?

algorithm - 是否有强一致的组成员协议(protocol)?

haskell - 为什么我的 IO 在 Erlang 中运行得这么慢?

haskell - 怎么++和: be used interchangably in Haskell?

git - Git 是如何进行分布式源代码管理的?

java - java中客户端应用程序异常

数据库选择 : High-write, 低读

haskell - 我可以将字符串切成头尾后用作整个字符串吗(:as) and using recursion on it in Haskell?