我正在尝试从distributed-process文档中运行channelsDemo
,但当我尝试从channelsDemo
运行main
时,如下所示:
main = channelsDemo
我收到以下错误:
无法将预期类型
匹配IO ()
与实际类型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
我看到了问题,但无法弄清楚如何修复它。
答案 0 :(得分:4)
distributed-process
有一个runProcess
函数,似乎有正确的签名:
runProcess :: LocalNode -> Process () -> IO ()
并且可以创建LocalNode
:
newLocalNode :: Transport -> RemoteTable -> IO LocalNode