From: Mart Lubbers Date: Thu, 5 Mar 2020 15:35:13 +0000 (+0100) Subject: . X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=63d47d22bdd59ff91e668736d971d13e979c9941;p=clean-tests.git . --- diff --git a/cloudiTasks/cloudiTasks.icl b/cloudiTasks/cloudiTasks.icl index b80d5b0..73dec05 100644 --- a/cloudiTasks/cloudiTasks.icl +++ b/cloudiTasks/cloudiTasks.icl @@ -13,11 +13,25 @@ master // >-| 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 diff --git a/test.icl b/test.icl index 822f41d..dddfbe1 100644 --- a/test.icl +++ b/test.icl @@ -1,38 +1,20 @@ 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)