Z      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXY Safe-Infereda queue reference check if the queue is empty ;get the reference to new or existing queue trough its name +empty the queue (factually, it is deleted) version in the STM monad 9read the first element in the queue and delete it (pop) version in the STM monad push an element in the queue version in the STM monad Jreturn the list of all elements in the queue. The queue remains unchanged version in the STM monad =return the first element in the queue that has the given key version in the STM monad :return the list of all elements in the queue and empty it a version in the STM monad Ndelete all the elements of the queue that has the key of the parameter passed verison in the STM monad   Queue name the returned elems  Queue name the returned elems Z[\     Z[\None ]^_`abcdefgh ]^_`abcdef ]_^`abcdefgh Safe-Infered-use Data.TCache.syncCache to write the state 1number of seconds between saves when asyncronous size of the cache when async write state after every step Rprint the state changes along the workflow, that is, all the intermediate results (ijklmnopqrstuvwxyz{|}~ijklmnopqrstuvwxyz{|}~ijkl umnopqrstvwxyz{|}~None& .return conditions from the invocation of start/restart primitives %madapted from MonadCatchIO-mtl. Workflow need to express serializable constraints about the returned values, Jso the usual class definitions for lifting IO functions are not suitable. &Generalized version of  'Generalized version of  (Generalized version of  )gPMonadTrans permits |to define a partial monad transformer. They are not defined for all kinds of data mbut the ones that have instances of certain classes.That is because in the lift instance code there are some Shidden use of these classes. This also may permit an accurate control of effects. 8An instance of MonadTrans is an instance of PMonadTrans -fexecutes a computation inside of the workflow monad whatever the monad encapsulated in the workflow. 0 Warning: this computation is executed whenever ~ the workflow restarts, no matter if it has been already executed previously. This is useful for intializations or debugging. / To avoid re-execution when restarting use: 3 $ unsafeIOtoWF... iTo perform IO actions in a workflow that encapsulates an IO monad, use step over the IO action directly:   3 $ action instead of  3 $ unsafeIOtoWF $ action.Generalized version of  /?start or restart an anonymous workflow inside another workflow A its state is deleted when finished and the result is stored in  the parent' s WF state. 0Ta version of exec1 that deletes its state after complete execution or thread killed 1*a version of exec with no seed parameter. 25start or continue a workflow with exception handling < | the workflow flags are updated even in case of exception  | WFerrors are raised as exceptions 3rlifts a monadic computation to the WF monad, and provides transparent state loging and resuming of computation 4Ipermits modification of the workflow state by the procedure being lifted L if the boolean value is True. This is used internally for control purposes 59start or continue a workflow with no exception handling. F | the programmer has to handle inconsistencies in the workflow state  | using A or C in case of exception. 6start or continue a workflow from a list of workflows in the IO monad with exception handling. The excepton is returned as a Left value 7kre-start the non finished workflows in the list, for all the initial values that they may have been called 88The execution log is cached in memory using the package TCacheQ. This procedure defines the polcy for writing the cache into permanent storage. "For fast workflows, or when TCache`$ is used also for other purposes ,  Asynchronous is the best option  Asynchronous mode invokes -. For more complex use of the syncronization  please use this . (When interruptions are controlled, use  mode and include a call to  in the finalizaton code 9Areturn all the steps of the workflow log. The values are dynamic /to get all the steps with result of type Int:  all <- 9  let lfacts = mapMaybe  all :: [Int] :?return the list of object keys that are running for a workflow ;=return the current state of the computation, in the IO monad ?<kill the executing thread if not killed, but not its state.  2 5 or 7 will continue the workflow @ a version of  KillThreadWF+ for workflows started wit no parameter by 1 A;kill the process (if running) and drop it from the list of R restart-able workflows. Its state history remains , so it can be inspected with   getWfHistory printWFHistory and so on B a version of KillWF+ for workflows started wit no parameter by 1 C[delete the WF from the running list and delete the workflow state from persistent storage. < Use it to perform cleanup if the process has been killed. D a version of C+ for workflows started wit no parameter by 1 FTReturn the reference to the last logged result , usually, the last result stored by 3. > wiorkflow references can be accessed outside of the workflow $ . They also can be (de)serialized. EWARNING getWFRef can produce casting errors when the type demanded - do not match the serialized data. Instead,  and G are type safe at runtuime. GSExecute an step but return a reference to the result instead of the result itself stepWFRef exp= 3 exp >>= FH*Log a value and return a reference to it.  newWFRef x= 3 $ return x >>= FI\Read the content of a Workflow reference. Note that its result is not in the Workflow monad JOWrites a new value en in the workflow reference, that is, in the workflow log. Z Why would you use this?. Don do that!. modifiying the content of the workflow log would d change the excution flow when the workflow restarts. This metod is used internally in the package K the best way to communicate with a workflow is trough a persistent queue: worflow= exec1 wf do  r <- G expr  push "queue" r  back <- pop " queueback"  ... KALog a message in the workflow history. I can be printed out with printWFhistory 3 The message is printed in the standard output too L4observe the workflow log untiil a condition is met. N9Start the timeout and return the flag to be monitored by O n This timeout is persistent. This means that the time start to count from the first call to getTimeoutFlag on b no matter if the workflow is restarted. The time that the worlkflow has been stopped count also. 5 the wait time can exceed the time between failures. % when timeout is 0 means no timeout. OVWait until a certain clock time has passed by monitoring its flag, in the STM monad. F This permits to compose timeouts with locks waiting for data using  iexample: wait for any respoinse from a Queue if no response is given in 5 minutes, it is returned True.   flag <- N $ 5 * 60  ap  )- 'step' . atomically $ readSomewhere >= return . Just  O flag >> return Nothing  case ap of  Nothing -> do K timeout ...  Just x -> do K $ received ++ show x ... 8An instance of MonadTrans is an instance of PMonadTrans  plift= step : !"#$%&'()*+,-./012345#name thar identifies the workflow. workflow to execute Ginitial value (ever use the initial value for restarting the workflow) result of the computation 6&name of workflow in the workflow list Hinitial value (ever use the initial value even to restart the workflow) function to execute result of the computation 789:;<=>?@ABCDEFGHIJKL2The condition that the retrieved object must meet The workflow name 3the INITIAL value used in the workflow to start it (The first event that meet the condition M2The condition that the retrieved object must meet The workflow name 3The INITIAL value used in the workflow to start it (The first event that meet the condition NO< !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNO<,+)*%&'(.5201/67 $#"!34-FHGIJ>9:;LMONKE?AC@BD<=82 $#"!%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNO Safe-InferedUdspawn a list of independent workflows (the first argument) with a seed value (the second argument).  Their results are reduced by V or W VYwait for the results and apply the cond to produce a single output in the Workflow monad W0select the outputs of the workflows produced by U constrained within a timeout. P The check filter, can select , discard or finish the entire computation before E the timeout is reached. When the computation finalizes, it stop all ? the pending workflows and return the list of selected outputs V the timeout is in seconds and is no limited to Int values, so it can last for years. fThis is necessary for the modelization of real-life institutional cycles such are political elections  timeout of 0 means no timeout. Xkspawn a list of workflows and reduces the results according with the comp parameter within a given timeout   vote timeout actions comp x= N split actions x >>= select timeout (const $ return Select) >>= comp YMsum the outputs of a list of workflows according with its monoid definition @ sumUp timeout actions = vote timeout actions (return . mconcat) PQRSTUVWXY PQRSTUVWXY UVWXYPTSRQPTSRQUVWXY      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[X\]^_`abcdefghijklmnopp qqrstuvwxyzz{|}~./0Workflow-0.6.0.0Control.WorkflowData.Persistent.QueueControl.Workflow.PatternsControl.Workflow.IDynamicControl.Workflow.StatTCache-0.9.0.2Data.TCache.DefaultPersistencedefPathkey IndexableRefQueue unreadSTMisEmpty isEmptySTMgetQRefflushflushSTMpoppopSTMpickpushpushSTMpickAll pickAllSTMpickElem pickElemSTMreadAll readAllSTM deleteElem deleteElemSTM safeFromIDynWFRefSyncMode SyncManual Asyncronous frecuency cacheSize Synchronous printHistoryWFErrors ExceptionTimeoutAlreadyRunningNotFound MonadCatchIOcatchblockunblock PMonadTransplift WorkflowListWorkflow unsafeIOtoWFthrowwfExecexec1dexec1execstep stepControlstartstartWFrestartWorkflows syncWritegetAll getWFKeys getWFHistory delWFHistory delWFHistory1 waitWFActive killThreadWF killThreadWF1killWFkillWF1delWFdelWF1clearRunningFlaggetWFRef stepWFRefnewWFRef readWFRef writeWFReflogWFwaitFor waitForSTMgetTimeoutFlag waitUntilSTMSelect FinishSelect FinishDiscardDiscardsplitmergeselectvotesumUp$fSerializableQueue$fSerializeQueue$fIndexableQueueIDynTypeDLeftDRightIDynamicIDyn errorfied dynPrefix dynPrefixSptoIDynfromIDyn$fShowIDynamic$fSerializeIDynamicPrettyStatwfNamestateindexrecoverversionstimeoutselfRunningWFst tvSyncWritestat0 statPrefixkeyWF keyRunningwFRefStr$fSerializeWFRef$fIndexableInteger$fIndexableInt $fIndexable[] $fShowPretty$fSerializeThreadId$fSerializablea$fIndexableWFRef$fSerializeStat$fIndexableStatbaseControl.Exception.BaseGHC.IOthrowIO Data.TCacheclearSyncCache syncCachenewDBRef GHC.Conc.SyncorElse$fPMonadTranstma$fPMonadTransWFma$fExceptionWFErrors$fShowWFErrors $fIndexable() $fHasForkWF$fMonadCatchIOWFa $fMonadIOWF $fFunctorWF $fMonadWF$fExceptionSelect