我正在尝试从 distributed-process 运行 channelsDemo
文档,但是当我尝试从 main
运行 channelsDemo
时,如下所示:
main = channelsDemo
我收到以下错误:
Couldn't match expected type
IO ()
with actual typeProcess ()
这是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/