9 Start w = flip doTasks w $
10 updateInformation () [] 42
11 >>* [OnAction (Action "Continue") (always (return 43))]
13 (>>*) infixl 1// :: !(Task a) ![TaskCont a (Task b)] -> Task b | iTask a & iTask b
14 (>>*) task steps :== step task (const Nothing) steps
16 step :: !(Task a) ((Maybe a) -> Maybe b) [TaskCont a (Task b)] -> Task b | iTask a & iTask b
17 step lhs lhsValFun conts
19 [(Embedded, \stl->lhs @? \v->case v of
20 NoValue = Value (Left Nothing) False
21 (Value v s) = Value (Left (Just v)) s
26 stepVal :: ((Maybe a) -> Maybe b) (TaskValue [(Int, TaskValue (Either (Maybe a) b))]) -> TaskValue b
27 stepVal tfun NoValue = NoValue
28 stepVal tfun (Value [(_, x):_] _) = case x of
30 Value (Left l) s = case tfun l of
32 Just v = Value v False
33 //Stepped but no value
35 Value (Right r) s = Value r s
36 stepVal _ _ = abort "cannot happen"
38 stepCont :: (TaskCont a (Task b)) -> TaskCont
39 [(Int, TaskValue (Either (Maybe a) b))]
40 (ParallelTaskType, ParallelTask (Either (Maybe a) b))
41 stepCont (OnValue f) = OnValue (transform f)
42 stepCont (OnAction a f) = OnAction a (transform f)
46 Value [(_, v)] _ = case v of
48 Value (Left (Just v)) s = Value v s
53 Just t = Just (Embedded, \stl->
54 get (sdsFocus {onlyIndex=Nothing,onlyTaskId=Nothing,onlySelf=False,includeValue=False,includeProgress=False,includeAttributes=False} stl)
58 // stepCont (OnException f) = OnException \e->(Embedded, \stl->e f @ Right)
59 // stepCont (OnAllExceptions b) = OnAllExceptions b