module test
-import Data.Func
import iTasks.Extensions.DateTime
-import qualified Data.Map as DM
-import qualified Data.Set as DS
+import System.Time
import iTasks
-//:: SDSStamped sds p r w = SDSStamped String (sds p (DateTime, r) (DateTime, w))
-//instance Identifiable (SDSStamped sds) | Identifiable sds
-//where
-// nameSDS (SDSStamped n sds) acc = ["t$":nameSDS sds ["$t":acc]]
-//instance Readable (SDSStamped sds) | Readable sds
-//where
-// readSDS (SDSStamped name sds) p c iworld
-// = case readSDS sds p c iworld of
-// (Error e, iworld) = (Error e, iworld)
-// (Ok (ReadResult r ssds), iworld)
-// = (Ok (ReadResult r (SDSStamped name ssds)), iworld)
-// (Ok (AsyncRead sds), iworld)
-// = (Ok (AsyncRead (SDSStamped name sds)), iworld)
-//
-
-:: SDSNoNotify p r w = E.sds: SDSNoNotify (sds p r w) & RWShared sds
-instance Identifiable SDSNoNotify where
- nameSDS (SDSNoNotify sds) c = nameSDS sds c
-instance Readable SDSNoNotify where
- readSDS (SDSNoNotify sds) p c iworld
- = case readSDS sds p c iworld of
- (Error e, iworld) = (Error e, iworld)
- (Ok (ReadResult r sds), iworld)
- = (Ok (ReadResult r sds), iworld)
- (Ok (AsyncRead sds), iworld)
- = (Ok (AsyncRead sds), iworld)
-
-instance Writeable SDSNoNotify where
- writeSDS (SDSNoNotify sds) p c w iworld
- = case writeSDS sds p c w iworld of
- (Error e, iworld) = (Error e, iworld)
- (Ok (WriteResult _ sds), iworld)
- = (Ok (WriteResult 'DS'.newSet (SDSNoNotify sds)), iworld)
- (Ok (AsyncWrite sds), iworld)
- = (Ok (AsyncWrite (SDSNoNotify sds)), iworld)
-instance Registrable SDSNoNotify where
- readRegisterSDS (SDSNoNotify sds) p c _ _ iworld
- = case readSDS sds p c iworld of
- (Error e, iworld) = (Error e, iworld)
- (Ok (ReadResult r sds), iworld)
- = (Ok (ReadResult r sds), iworld)
- (Ok (AsyncRead sds), iworld)
- = (Ok (AsyncRead sds), iworld)
-instance Modifiable SDSNoNotify where
- modifySDS mf (SDSNoNotify sds) p c iworld
- = case modifySDS mf sds p c iworld of
- (Error e, iworld) = (Error e, iworld)
- (Ok (ModifyResult _ r w sds), iworld)
- = (Ok (ModifyResult 'DS'.newSet r w (SDSNoNotify sds)), iworld)
- (Ok (AsyncModify sds mf), iworld)
- = (Ok (AsyncModify (SDSNoNotify sds) mf), iworld)
-
-
-sh = sharedStore "bork" ({DateTime|year=0,mon=0,day=0,hour=0,min=0,sec=0}, 42)
+sh = sharedStore "bork1" ({DateTime|year=0,mon=0,day=0,hour=0,min=0,sec=0}, 42)
+sh` = sharedStore "bork2" ({Timespec|tv_sec=0,tv_nsec=0}, 42)
Start w = doTasks t w
-//Start w = nameSDS (SDSStamped "bork" sh) []
-
-stampedShare :: (Shared sds (DateTime, a)) -> SDSLens () (DateTime, a) a | TC a & RWShared sds
-stampedShare sds =
- mapReadWrite (fst , \a (_, dt)->Just ((dt, a), dt)) Nothing
- $ sds >*< (mapWrite (\_ _->Nothing) Nothing currentDateTime)
-t = viewSharedInformation [] sh
- -&&- updateSharedInformation [] (stampedShare sh)
+t = viewSharedInformation [] sh
+ -&&- updateSharedInformation [] (dateTimeStampedShare sh)
+ -&&- viewSharedInformation [] sh`
+ -&&- updateSharedInformation [] (timespecStampedShare sh`)
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")