// >-| asyncTask (ExistingNode "localhost" 9099) (blockWait 5)
// >-| asyncTask "localhost" 9090 (blockWait 5)
// >-| asyncTask (PrivateNode 9099) (traceValue 5 >-| traceValue 42)
-// >-| asyncTaskSpawn 9099 (return 42)
- >-| sleepSortPar [5,1,3,8]
+ >-| asyncTaskSpawn 9099 (return 42)
+ >-| asyncTaskSpawn 9099 (updateInformation [] 42)
+// >-| (updateInformation [] 42 -&&- updateInformation [] 22) @. ("localhost", 9099)
+// >-| asyncTaskSpawn 9099 (updateInformation [] 42 -&&- updateInformation [] 22)
+// >-| sleepSortPar [5,1,3,8]
>&^ viewSharedInformation []
@! ()
+asyncTaskChannel :: !String !Int !((sds () (Queue r) w) -> Task a) !((sds () (Queue w) r) -> Task b) -> Task (a, b)
+asyncTaskChannel host port remote local
+ = asyncTask host port (remote shareTo)
+ -&&-
+where
+ shareTo :: (sds () (Queue r) (Queue r))
+ shareTo = sdsFocus ("to-" +++ host +++ toString port) $ memoryStore "asyncITasks-channels" (Just newQueue)
+
+ shareFro :: (sds () (Queue w) (Queue w))
+ shareFro = sdsFocus ("fro-" +++ host +++ toString port) $ memoryStore "asyncITasks-channels" (Just newQueue)
+
blockWait :: Int -> Task Int
blockWait i = accWorld (sleep i)
where
module test
import StdEnv
-import Data.Maybe
-import Data.Functor
-import Control.Monad
-import Control.Applicative
-class expr v where
- lit :: i -> v i | toString i
- (+.) infixl 6 :: (v i) (v i) -> v i | + i
+import graph_copy_with_names, symbols_in_program
+import System.CommandLine
-instance + (v a) | expr v & + a where
- + l r = l +. r
+test :: !{#Symbol} a -> a
+test symbols a
+ # (a, b, c) = copy_to_string_with_names a
+ # (a, r) = copy_from_string_with_names a b c symbols
+ = a
-eval :: (Maybe a) -> Maybe a
-eval x = x
-instance expr Maybe where
- lit i = Just i
- +. x y = (+) <$> x <*> y
+polyid :: (A.a: a -> a) -> (Int, Bool)
+polyid f = (f 42, f True)
-:: Print a =: Print String
-print :: (Print a) -> String
-print (Print a) = a
-instance expr Print where
- lit i = Print (toString i)
- +. (Print l) (Print r) = Print (l +++ "+" +++ r)
-
-printEval :: (A.v: v a | expr v) -> (Maybe a, String)
-//printEval f = (f, let (Print p) = f in p)
-printEval f = (eval f, print f)
-
-//Mag niet
-//Start :: (Maybe Int, String)
-//Start = printEval (lit 4 + lit 38)
-
-//Mag wel
-Start = let (Print f) = lit 4 + lit 38 in f
+Start w
+ # ([argv0:_], w) = getCommandLine w
+ # (symbols, w) = accFiles (read_symbols argv0) w
+ = test symbols (polyid id)