X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=miTask.icl;h=5436ffe698d7d526a65dbf9704aa1acc7d329b27;hb=af388f6b2c06d38b400d482ac3ccc1f819b5bf9f;hp=275745077ebc771b12583452dd8c56337423864a;hpb=f90517d738696125a067f113edf93f404873115b;p=mTask.git diff --git a/miTask.icl b/miTask.icl index 2757450..5436ffe 100644 --- a/miTask.icl +++ b/miTask.icl @@ -8,6 +8,7 @@ import mTask from Text import class Text(startsWith,concat,split,join), instance Text String +from Data.Func import $ import Data.Tuple import System.Directory @@ -82,7 +83,7 @@ mTaskTask = let (msgs, sdsShares) = makeMsgs 1000 bc in >>= \p->sendMsg (fst (makeMsgs 0 (bc2 p))) ch) ||- forever (enterChoice "Choose led to disable" [] [LED1, LED2, LED3] >>= \p->sendMsg (fst (makeMsgs 0 (bc3 p))) ch) - ||- viewSharedInformation "channels" [ViewWith lens] ch + ||- viewSharedInformation "channels" [ViewAs lens] ch ||- viewSharedInformation "messages" [] messageShare ||- viewSh sdsShares ch >>* [OnAction ActionFinish (always shutDown)] @@ -151,10 +152,10 @@ syncSerialChannel dev opts rw = Task eval # iworld = {iworld & world=world, resources=Just (TTYd tty)} = case addBackgroundTask 42 (BackgroundTask (serialDeviceBackgroundTask rw)) iworld of (Error e, iworld) = (ExceptionResult (exception "h"), iworld) - (Ok _, iworld) = (ValueResult NoValue {TaskEvalInfo|lastEvent=ts,removedTasks=[],refreshSensitive=True} NoRep (TCBasic taskId ts JSONNull False), iworld) + (Ok _, iworld) = (ValueResult NoValue {TaskEvalInfo|lastEvent=ts,removedTasks=[],refreshSensitive=True} NoChange (TCBasic taskId ts JSONNull False), iworld) eval _ _ tree=:(TCBasic _ ts _ _) iworld - = (ValueResult NoValue {TaskEvalInfo|lastEvent=ts,removedTasks=[],refreshSensitive=False} NoRep tree, iworld) + = (ValueResult NoValue {TaskEvalInfo|lastEvent=ts,removedTasks=[],refreshSensitive=False} NoChange tree, iworld) eval event evalOpts tree=:(TCDestroy _) iworld=:{IWorld|resources,world} # (TTYd tty) = fromJust resources @@ -164,10 +165,10 @@ syncSerialChannel dev opts rw = Task eval (Error e, iworld) = (ExceptionResult (exception "h"), iworld) (Ok _, iworld) = (DestroyedResult, iworld) -serialDeviceBackgroundTask :: (Shared ([MTaskMSGRecv],[MTaskMSGSend],Bool)) !*IWorld -> *IWorld +serialDeviceBackgroundTask :: (Shared ([MTaskMSGRecv],[MTaskMSGSend],Bool)) !*IWorld -> (MaybeError TaskException (), *IWorld) serialDeviceBackgroundTask rw iworld = case read rw iworld of - (Error e, iworld) = abort "share couldn't be read" + (Error e, iworld) = (Error $ exception "share couldn't be read", iworld) (Ok (r,s,ss), iworld) # (Just (TTYd tty)) = iworld.resources # tty = writet (map encode s) tty @@ -178,10 +179,10 @@ serialDeviceBackgroundTask rw iworld = ([decode l], tty) # iworld = {iworld & resources=Just (TTYd tty)} = case write (r++ml,[],False) rw iworld of - (Error e, iworld) = abort "share couldn't be written" + (Error e, iworld) = (Error $ exception "share couldn't be written", iworld) (Ok _, iworld) = case notify rw iworld of - (Error e, iworld) = abort "share couldn't be notified" - (Ok _, iworld) = iworld + (Error e, iworld) = (Error $ exception "share couldn't be notified", iworld) + (Ok _, iworld) = (Ok (), iworld) where writet :: [String] -> (*TTY -> *TTY) writet [] = id