import Data.Either
import StdEnv
import Data.Func
+import Data.Functor
Start w = flip doTasks w $
updateInformation () [] 42
Value (Right r) s = Value r s
stepVal _ _ = abort "cannot happen"
- stepCont :: (TaskCont a (Task b)) -> TaskCont
- [(Int, TaskValue (Either (Maybe a) b))]
- (ParallelTaskType, ParallelTask (Either (Maybe a) b))
stepCont (OnValue f) = OnValue (transform f)
stepCont (OnAction a f) = OnAction a (transform f)
+ stepCont (OnException f) = OnException \e->add (f e)
+ stepCont (OnAllExceptions f) = OnAllExceptions \e->add (f e)
transform f v
# v = case v of
Value [(_, v)] _ = case v of
NoValue = NoValue
Value (Left (Just v)) s = Value v s
- Value _ = NoValue
+ Value _ _ = NoValue
NoValue = NoValue
- = case f v of
- Nothing = Nothing
- Just t = Just (Embedded, \stl->
- get (sdsFocus {onlyIndex=Nothing,onlyTaskId=Nothing,onlySelf=False,includeValue=False,includeProgress=False,includeAttributes=False} stl)
- removeTask taskId stl
- >-| t @ Right)
+ = add <$> f v
+
+ add t = (Embedded, \stl->
+ get (sdsFocus {onlyIndex=Nothing,onlyTaskId=Nothing,onlySelf=False,includeValue=False,includeProgress=False,includeAttributes=False} stl)
+ >>- \(_, pts)->case pts of
+ [tli:_] = removeTask tli.TaskListItem.taskId stl
+ >-| t @ Right
+ _ = abort "shouldn't happen"
+ )
-// stepCont (OnException f) = OnException \e->(Embedded, \stl->e f @ Right)
-// stepCont (OnAllExceptions b) = OnAllExceptions b