1+ {-# LANGUAGE StaticPointers #-}
12{-# LANGUAGE DeriveDataTypeable #-}
2- {-# LANGUAGE TemplateHaskell #-}
33{-# LANGUAGE ScopedTypeVariables #-}
44
55module Main where
@@ -12,7 +12,7 @@ import Control.Distributed.Process.Serializable()
1212import Control.Distributed.Process.Async
1313import Control.Distributed.Process.SysTest.Utils
1414import Control.Monad (replicateM_ )
15- import Data.Binary ( )
15+ import Data.Binary ( decode , encode )
1616import Data.Typeable ()
1717import Network.Transport.TCP
1818import qualified Network.Transport as NT
@@ -139,18 +139,15 @@ testAsyncWaitCancelTimeout result = do
139139 p1 <- async $ task expect
140140 waitCancelTimeout 1000000 p1 >>= stash result
141141
142- remotableDecl [
143- [d | fib :: (NodeId,Int) -> Process Integer ;
144- fib (_,0) = return 0
145- fib (_,1) = return 1
146- fib (myNode,n) = do
147- let tsk = remoteTask ($(functionTDict 'fib)) myNode ($(mkClosure 'fib) (myNode,n-2))
148- future <- async tsk
149- y <- fib (myNode,n-1)
150- (AsyncDone z) <- wait future
151- return $ y + z
152- |]
153- ]
142+ fib :: (NodeId ,Int ) -> Process Integer
143+ fib (_,0 ) = return 0
144+ fib (_,1 ) = return 1
145+ fib (myNode,n) = do
146+ let tsk = remoteTask (static SerializableDict ) myNode (closure (static (fib . decode)) (encode (myNode, n- 2 )))
147+ future <- async tsk
148+ y <- fib (myNode,n- 1 )
149+ (AsyncDone z) <- wait future
150+ return $ y + z
154151
155152-- Tests that wait returns when remote actions complete.
156153testAsyncRecursive :: TestResult Integer -> Process ()
@@ -212,7 +209,7 @@ tests localNode = testGroup "" [
212209
213210asyncStmTests :: NT. Transport -> IO TestTree
214211asyncStmTests transport = do
215- localNode <- newLocalNode transport $ __remoteTableDecl initRemoteTable
212+ localNode <- newLocalNode transport
216213 let testData = tests localNode
217214 return testData
218215
0 commit comments