我使用的主要功能是
sorted :: [Integer] -> Process Bool
sorted a = same $ map (>0) $ filter (/=0) $ zipWith (-) a (tail a)
where
same (x:xs) = and $ map (==x) xs
当我使用ghc编译程序时,我收到以下错误。
shreyas@shreyas-Inspiron-13-7368:~/Desktop/haskell/my-project/src$ ghc Main.hs[1 of 1] Compiling Main ( Main.hs, Main.o )
Main.hs:9:12: error:
• Couldn't match expected type ‘Process Bool’
with actual type ‘Bool’
• In the expression:
same $ map (> 0) $ filter (/= 0) $ zipWith (-) a (tail a)
In an equation for ‘sorted’:
sorted a
= same $ map (> 0) $ filter (/= 0) $ zipWith (-) a (tail a)
where
same (x : xs) = and $ map (== x) xs
然后我在“排序
”上调用了遥控器remotable ['sorted]
并在master函数中我接受它的mkClosure并将输入数组作为参数传递给sorted函数。
master :: [NodeId] -> Process ()
master [] = liftIO $ putStrLn "no slaves"
master (slave:_) = do
sortedTrio <- call $(functionTDict 'sorted) slave ($(mkClosure 'sorted)([1,2,3]::[Integer]))
liftIO $ print sortedTrio
我无法弄清楚错误。任何帮助都非常感谢。