X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=test.icl;h=2350a9a721c08da33bea0b08cc4bd588bcfd0bab;hb=e5305ee9d4290e1aa803a2e62a14f32e5cd29782;hp=e437b71b5467242b2ceaba67ac76d6bdd2d99910;hpb=171db1fa253aaaad79fcbe19afaa277379ac9570;p=clean-tests.git diff --git a/test.icl b/test.icl index e437b71..2350a9a 100644 --- a/test.icl +++ b/test.icl @@ -1,90 +1,52 @@ module test -import iTasks - -import iTasks.Extensions.DateTime -import iTasks.UI.Layout.Minimal - -Start w = doTasksWithOptions opt p2 w -where - t :: Task DateTime - t = waitForTimer 7 - t2 :: Task Int - t2 = enterInformation () [] >>= viewInformation () [] - t3 :: Task String - t3 = withShared 3 \sh-> - withTemporaryDirectory (viewInformation () []) - >>= viewInformation () [] - t4 = updateInformation () [] 42 - - t5 = sequence [return i\\i<-[0..1000]] >>= viewInformation () [] - t6 = waitForTimer 10 - - t7 :: Int -> Task Int - t7 i = viewInformation () [] i >>= \x->t7 (x + 1) - - p = parallel [(Embedded, \_->waitForTimer 5)] [] - p1 = waitForTimer 5 -||- waitForTimer 10 - p2 = withShared 3 \sh->watch sh - - opt args eo = Ok eo -// opt args eo = Ok {eo & autoLayout=False} - +import StdEnv, StdGeneric +import Data.Array + +Start :: [{!Int}] +Start = + [ appendArr {!1,2,3} {!4,5,6,7} + , appendArr {!} {!} + , appendArr {!} {!1,2,3} + , appendArr {!1,2,3} {!} + ] /* -//import StdEnv -//import Data.Error -//import Data.Maybe -//import Network.IP -//import System.Socket -//import System.Socket.Ipv4 -////import System.Select -// -from Data.Map import singleton -import Data.Map.GenJSON -//import Data.Func -import iTasks - -import iTasks.Extensions.Files - -//Start w = doTasks (onStartup (copyFile "/home/mrl/test.txt" "/home/mrl/test2.txt")) w -//Start w = doTasks (onStartup (workAs SystemUser (return 42))) w -Start w = doTasks t w - -t = viewInformation () [] () - >>* [OnAction ActionOk (always (return ())) - ,OnAction ActionQuit (always (return ())) - ] - -//Start w = doTasks t w -// -//t :: Task [(Int, TaskValue Int)] -//t = parallel -// [(Embedded, \stl-> -// appendTask Embedded (\_->viewInformation "Int" [] 42) stl -// >>! \i->set (singleton "focus" "true") (sdsFocus i (taskListEntryMeta stl)) -// >>~ \_->viewSharedInformation "Parallel task list" [] -// (sdsFocus {onlyIndex=Nothing,onlyTaskId=Nothing,onlySelf=False,includeValue=True,includeProgress=True,includeAttributes=True} stl) -// @! 42 -// )] [] - - -//import StdGeneric -// -//generic g a :: a -// -//g{|*|} = 42 - -//Start :: *World -> (MaybeOSError String, *World) -//Start w -// = case socket SocketStream w of -// (Error e, w) = (Error e, w) -// (Ok sockfd, w) -// #! (merr, sockfd) = connect {ipv4_socket_port=8124,ipv4_socket_addr=Just (fromString "127.0.0.1")} sockfd -// | isError merr = (liftError merr, w) -// #! (merr, sockfd) = recv 128 [] sockfd -// | isError merr = (merr, w) -// # (Ok msg) = merr -// # (merr, w) = close sockfd w -// | isError merr = (liftError merr, w) -// = (Ok msg, w) +derive bimap Box + +:: Box b a =: Box b + +unBox (Box b) :== b +box b :== Box b + +generic gPotentialInf a :: [String] -> Box Bool a + +gPotentialInf{|World|} _ = box False +gPotentialInf{|File|} _ = box False +gPotentialInf{|Bool|} _ = box False +gPotentialInf{|Char|} _ = box False +gPotentialInf{|Real|} _ = box False +gPotentialInf{|Int|} _ = box False +gPotentialInf{|Dynamic|} _ = box False +gPotentialInf{|(->)|} _ _ _ = box False +gPotentialInf{|{}|} a m = box (unBox (a m)) +gPotentialInf{|{!}|} a m = box (unBox (a m)) +gPotentialInf{|{#}|} a m = box (unBox (a m)) +gPotentialInf{|UNIT|} _ = box False +gPotentialInf{|EITHER|} l r m = box (unBox (l m) || unBox (r m)) +gPotentialInf{|PAIR|} l r m = box (unBox (l m) || unBox (r m)) +gPotentialInf{|CONS|} x m = box (unBox (x m)) +gPotentialInf{|FIELD|} x m = box (unBox (x m)) +gPotentialInf{|RECORD of {grd_name}|} x m + | isMember grd_name m = box True + = box (unBox (x [grd_name:m])) +gPotentialInf{|OBJECT of {gtd_name}|} x m + | isMember gtd_name m = box True + = box (unBox (x [gtd_name:m])) + +//derive gPotentialInf Int,Bool,Char,Real,String,File,World,Dynamic +derive gPotentialInf (),(,),(,,),(,,,),(,,,,),(,,,,,),(,,,,,,),(,,,,,,,),(,,,,,,,,),(,,,,,,,,,),(,,,,,,,,,,),(,,,,,,,,,,,),(,,,,,,,,,,,,),(,,,,,,,,,,,,,),(,,,,,,,,,,,,,,),(,,,,,,,,,,,,,,,),(,,,,,,,,,,,,,,,,),(,,,,,,,,,,,,,,,,,),(,,,,,,,,,,,,,,,,,,),(,,,,,,,,,,,,,,,,,,,),(,,,,,,,,,,,,,,,,,,,,),(,,,,,,,,,,,,,,,,,,,,,),(,,,,,,,,,,,,,,,,,,,,,,),(,,,,,,,,,,,,,,,,,,,,,,,),(,,,,,,,,,,,,,,,,,,,,,,,,),(,,,,,,,,,,,,,,,,,,,,,,,,,),(,,,,,,,,,,,,,,,,,,,,,,,,,,),(,,,,,,,,,,,,,,,,,,,,,,,,,,,),(,,,,,,,,,,,,,,,,,,,,,,,,,,,,),(,,,,,,,,,,,,,,,,,,,,,,,,,,,,,),(,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) +derive gPotentialInf {},{#},{!},[],[! ],[ !],[!!],[#],[#!] + +Start :: Box Bool *File +Start = gPotentialInf{|*|} [] */