module test
-import Data.Func
-import qualified Data.Map as DM
-import iTasks
+import StdEnv
+from Data.Func import $
+import System.Directory
+import System.Time
-/*
-Start w = doTasksWithOptions
-// (\a o->Ok o)
- (\a o->Ok {o & autoLayout=False})
- (parallel
- [(Embedded, tab "tab1")
- ,(Embedded, tab "tab2")
- ]
- [ OnAction (Action "New") (always (Embedded, tab "New tab"))
- , OnAction (Action " ") (always (Embedded, tab "New tab"))
- , OnAction (Action "Close") (never (Embedded, \_->treturn ()))
- , OnAction (Action "Dis no icon") (never (Embedded, \_->treturn ()))
- , OnAction (Action "+") (always (Embedded, \_->treturn ()))
- ]
-// <<@ ArrangeWithTabs True
- <<@ ApplyLayout (setActionIcon ('DM'.put " " "new" 'DM'.newMap))
- ) w
+:: S s a = S .(s -> *(a, s))
+runS (S s) = s
-tab title _ = tune (Title title)
- $ viewInformation [] title
- >>* [OnAction (Action "Close") (always (treturn ()))]
-*/
+(>>=) infixl 1 :: u:(S .a .b) v:(.b -> .(S .a .c)) -> w:(S .a .c), [w <= u,w <= v]
+(>>=) ma a2mb = S \s
+ # (a, s) = runS ma s
+ = runS (a2mb a) s
-import StdDebug, Text.GenPrint
-Start w = doTasks (onStartup t) w
-
-null :: SDSSource () () ()
-null = nullShare
-
-t = tcpconnect "localhost" 9999 (Just 500) null
-//t = tcpconnect "localhost" 9999 Nothing null
- { onConnect = \cid host r = trace_n (printToString ("onConnect: ", cid, host, r))
- (Ok (), Nothing, [], False)
- , onData = \ data l r = trace_n (printToString ("onData: ", data, l, r))
- (Ok (), Nothing, [], False)
- , onShareChange = \ l r = trace_n (printToString ("onShareChange: ", l, r))
- (Ok (), Nothing, [], False)
- , onDisconnect = \ l r = trace_n (printToString ("onDisconnect: ", l, r))
- (Ok (), Nothing)
- , onDestroy = \ l = trace_n (printToString ("onDestroy: ", l))
- (Ok (), [])
- }
+Start world = flip runS world
+ $ (S time)
+ >>= \_->S (readDirectory "/home/mrl")