D6      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~None"#+.1;<=>?CQVg4 represents a task in a task stream being generated. More tasks to come This is the last task No more tasks, we are done An error occurredRun m a& discarding its result before running m b.Run m b1 discarding its result, after the whole task set m a is done.Run m b0 discarding its result, once after each task in m a3, and once again after the whole task set is done.#&Dynamic serializable data for logging.&7Constraint type synonym for a value that can be logged.':EventF describes the context of a TransientIO computation:)RNot yet consumed result (event) from the last asynchronous run of the computation+List of continuations,.State data accessed with get or put operations/When ., threads are not killed using kill primitives0The parent of this thread1%Forked child threads, used only when / is 28Maximum number of threads that are allowed to be created3<Label the thread with its lifecycle state and a label stringBRun a "non transient" computation within the underlying state monad, so it is guaranteed that the computation neither can stop neither can trigger additional events/threads.D8Run a transient computation with a default initial stateE6Run a transient computation with a given initial stateFMGet the continuation context: closure, continuation, state, child threads etcGORun the closure and the continuation using the state data of the calling threadH>Run the closure and the continuation using its own state data.I2Warning: Radically untyped stuff. handle with careJ Compose a list of continuations.KRun the closure (the x- in 'x >>= f') of the current bind operation.LRun the continuation (the fD in 'x >>= f') of the current bind operation with the current state.M#Save a closure and a continuation (x and f in 'x >>= f').NvSave a closure and continuation, run the closure, restore the old continuation. | NOTE: The old closure is discarded.OURestore the continuations to the provided ones. | NOTE: Events are also cleared out.PRun a chain of continuations. WARNING: It is up to the programmer to assure that each continuation typechecks with the next, and that the parameter type match the input of the first continuation. NOTE: Normally this makes sense to stop the current flow with T after the invocation.T A synonym of n that can be used in a monadic expression. It stops the computation, which allows the next computation in an  () composition to run.URun b= once, discarding its result when the first task in task set aV has finished. Useful to start a singleton task after the first task has been setup.VBSet the current closure and continuation for the current statementWReset the closure and continuation. Remove inner binds than the previous computations may have stacked in the list of continuations. resetEventCont :: Maybe a -> EventF -> StateIO ()XTotal variant of 5 that returns an empty list when given an empty list.[Sets the maximum number of threads that can be created for the given task set. When set to 0, new tasks start synchronously in the current thread. New threads are created by , and APIs that use parallel.\Terminate all the child threads in the given task set and continue execution in the current thread. Useful to reap the children when a task is done.]XAdd a label to the current passing threads so it can be printed by debugging calls like __0Show the tree of threads hanging from the state.`GReturn the state of the thread that initiated the transient computationavReturn the state variable of the type desired with which a thread, identified by his number in the treee was initiatedbSreturn all the states of the type desired that are created by direct child threadscNAdd n threads to the limit of threads. If there is no limit, the limit is set.dFEnsure that at least n threads are available for the current task set.eSDisable tracking and therefore the ability to terminate the child threads. By default, child threads are terminated automatically when the parent thread dies, or they can be terminated using the kill primitives. Disabling it may improve performance a bit, however, all threads must be well-behaved to exit on their own to avoid a leak.fEnable tracking and therefore the ability to terminate the child threads. This is the default but can be used to re-enable tracking if it was previously disabled with e.g1Kill all the child threads of the current thread.h'Kill the current thread and the childs.i*Kill the childs and the thread of an statejSame as k8 but with a more general type. If the data is found, a ! value is returned. Otherwise, a  value is returned.k}Retrieve a previously stored data item of the given data type from the monad state. The data type to retrieve is implicitly determined by the data type. If the data item is not found, empty is executed, so the alternative computation will be executed, if any, or Otherwise, the computation will stop.. If you want to print an error message or a default value, you can use an  composition. For example: XgetSData <|> error "no data of the type desired" getInt = getSData <|> return (0 :: Int)lSame as kmmK stores a data item in the monad state which can be retrieved later using j or k. Stored data items are keyed by their data type, and therefore only one item of a given type can be stored. A newtype wrapper can be used to distinguish two data items of the same type. import Control.Monad.IO.Class (liftIO) import Transient.Base import Data.Typeable data Person = Person { name :: String , age :: Int } deriving Typeable main = keep $ do setData $ Person AlbertoF 55 Person name age <- getSData liftIO $ print (name, age) nAccepts a function that takes the current value of the stored data type and returns the modified value. If the function returns ) the value is deleted otherwise updated.o|Either modify according with the first parameter or insert according with the second, depending on if the data exist or not. runTransient $ do modifyData1 (\h -> h ++ " world") "hello new" ; r <- getSData ; liftIO $ putStrLn r -- > "hello new" runTransient $ do setData "hello" ; modifyData1 (\h -> h ++ " world") "hello new" ; r <- getSData ; liftIO $ putStrLn r -- > "hello world"pSame as modifyDataqSame as mr<Delete the data item of the given type from the monad state.sSame as rtQmutable state reference that can be updated (similar to STRef in the state monad)%Initialized the first time it is set.wRun an action, if it does not succeed, undo any state changes that it might have caused and allow aternative actions to run with the original statexHExecutes the computation and reset the state either if it fails or not. yKgenerates an identifier that is unique within the current program execution{wGenerator of identifiers that are unique within the current monadic sequence They are not unique in the whole program.}A task stream generator that produces an infinite stream of tasks by running an IO computation in a loop. A task is triggered carrying the output of the computation. See  for notes on the return value.~Run an IO computation asynchronously and generate a single task carrying the result of the computation when it completes. See  for notes on the return value.IForce an async computation to run synchronously. It can be useful in an  composition to run the alternative only after finishing a computation. Note that in Applicatives it might result in an undesired serialization.  spawn = freeThreads . waitEvents(A task stream generator that produces an infinite stream of tasks by running an IO computation periodically at the specified time interval. The task carries the result of the computation. A new task is generated only if the output of the computation is different from the previous one. See  for notes on the return value.[Run an IO action one or more times to generate a stream of tasks. The IO action returns a . When it returns an   or  H a new task is triggered with the result value. If the return value is  U, the action is run again to generate the next task, otherwise task creation stops./Unless the maximum number of threads (set with [g) has been reached, the task is generated in a new thread and the current thread returns a void task.*Execute the IO action and the continuationDkill all the child threads associated with the continuation contextFMake a transient task generator from an asynchronous callback handler.The first parameter is a callback. The second parameter is a value to be returned to the callback; if the callback expects no return value it can just be a  return ()5. The callback expects a setter function taking the  eventdataU as an argument and returning a value to the callback; this function is supplied by .jCallbacks from foreign code can be wrapped into such a handler and hooked into the transient monad using U. Every time the callback is called it generates a new task for the transient monad.:Runs the rest of the computation in a new thread. Returns  to the current thread-listen stdin and triggers a new task every time the input data matches the first parameter. The value contained by the task is the matched value i.e. the first argument itself. The second parameter is a message to the user for the user. The label is displayed in the console when the option match.Waits on stdin and return a value when a console input matches the predicate specified in the first argument. The second parameter is a string to be displayed on the console before waiting.Wait for the execution of ; and return the result or the exhaustion of thread activityRuns the transient computation in a child thread and keeps the main thread running until all the user threads exit or some thread invokes .The main thread provides facilities for accepting keyboard input in a non-blocking but line-oriented manner. The program reads the standard input and feeds it to all the async input consumers (e.g.  and ). All async input consumers contend for each line entered on the standard input and try to read it atomically. When a consumer consumes the input others do not get to see it, otherwise it is left in the buffer for others to consume. If nobody consumes the input, it is discarded.A /+ in the input line is treated as a newline.When using asynchronous input, regular synchronous IO APIs like getLine cannot be used as they will contend for the standard input along with the asynchronous input thread. Instead you can use the asynchronous input APIs provided by transient.A built-in interactive command handler also reads the stdin asynchronously. All available options waiting for input are displayed when the program is run. The following commands are available: ps: show threadslog: inspect the log of a threadend, exit: terminate the programJAn input not handled by the command handler can be handled by the program.*The program's command line is scanned for -p or --path command line options. The arguments to these options are injected into the async input channel as keyboard input to the program. Each line of input is separated by a /. For example:  foo -p ps/endSame as Q but does not read from the standard input, and therefore the async input APIs ( and x) cannot be used in the monad. However, keyboard input can still be passed via command line arguments as described in . Useful for debugging or for creating background tasks, as well as to embed the Transient monad inside another computation. It returns either the value returned by 6. or Nothing, when there are no more threads runninghExit the main thread, and thus all the Transient threads (and the application if there is no more code)If the first parameter is D return the second parameter otherwise return the first parameter..GDelete all the undo actions registered till now for the given track id.& for the default track; equivalent to  backCut ().fRun the action in the first parameter and register the second parameter as the undo action. On undo (E) the second parameter is called with the undo track id as argument.& for the default track; equivalent to  onBack ().Register an undo action to be executed when backtracking. The first parameter is a "witness" whose data type is used to uniquely identify this backtracking action. The value of the witness parameter is not used.For a given undo track id, stop executing more backtracking actions and resume normal execution in the forward direction. Used inside an undo action.+ for the default undo track; equivalent to  forward ().\Abort finish. Stop executing more finish actions and resume normal execution. Used inside  actions.Start the undo process for the given undo track id. Performs all the undo actions registered till now in reverse order. An undo action can use | to stop the undo process and resume forward execution. If there are no more undo actions registered execution stops and a T action is returned.+ for the default undo track; equivalent to back ().YClear all finish actions registered till now. initFinish= backCut (FinishReason Nothing)'Register an action that to be run when  is called. r can be used multiple times to register multiple actions. Actions are run in reverse order. Used in infix style.uRun the action specified in the first parameter and register the second parameter as a finish action to be run when ! is called. Used in infix style.@Execute all the finalization actions registered up to the last G, in reverse order and continue the execution. Either an exception or  can be+trigger finish when the stream of data endsInstall an exception handler. Handlers are executed in reverse (i.e. last in, first out) order when such exception happens in the continuation. Note that multiple handlers can be installed for the same exception type.6The semantic is, thus, very different than the one of 6Delete all the exception handlers registered till now.Use it inside an exception handler. it stop executing any further exception handlers and resume normal execution from this point on.'catch an exception in a Transient blockThe semantic is the same than C but the computation and the exception handler can be multirhreaded)throw an exception in the Transient monad  !"#$%&'(3210/.-,+*)487659:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~@A?<=>;:945678'()*+,-./0123BCDEFGHIJKLMNOPQRS&#$%"! TUVWXYZ[\]^_`abcdefghijklmnopqrs tuvwxyz{| }~  #$%' ()*+,-./012345678<=>111NoneVMKConverts a list of pure values into a transient task set. You can use the [& primitive to control the parallelism.Same as  except that the [G combinator cannot be used, instead the parent thread's limit applies./Collect the results of a task set in groups of n elements.Collect the results of a task set, grouping all results received within every time interval specified by the first parameter as .!Collect the results of the first n tasks. Synchronizes concurrent tasks to collect the results safely and kills all the non-free threads before returning the results. Results are returned in the thread where  is called.Like G but with a timeout. When the timeout is zero it behaves exactly like . If the timeout (second parameter) is non-zero, collection stops after the timeout and the results collected till now are returned.None1creates an EVar.Evars are event vars. C trigger the execution of all the continuations associated to the 1 of this variable (the code that is after them).It is like the publish-subscribe pattern but without inversion of control, since a readEVar can be inserted at any place in the Transient flow.wEVars are created upstream and can be used to communicate two sub-threads of the monad. Following the Transient philosophy they do not block his own thread if used with alternative operators, unlike the IORefs and TVars. And unlike STM vars, that are composable, they wait for their respective events, while TVars execute the whole expression when any variable is modified.TThe execution continues after the writeEVar when all subscribers have been executed./Now the continuations are executed in parallel.see Yhttps://www.fpcomplete.com/user/agocorona/publish-subscribe-variables-transient-effects-v(delete al the subscriptions for an evar.read the EVar. It only succeed when the EVar is being updated The continuation gets registered to be executed whenever the variable is updated.if readEVar is re-executed in any kind of loop, since each continuation is different, this will register again. The effect is that the continuation will be executed multiple times To avoid multiple registrations, use Qupdate the EVar and execute all readEVar blocks with "last in-first out" priority write the EVar and drop all the  handlers.It is like a combination of  and NoneV2 9<T[\defgjklmnopqrstuw{}~2<9T ~}mkjrnowqlsutp[def\g{ None1CVf None;=CV.Reads the saved logs from the logs subdirectory of the current directory, restores the state of the computation from the logs, and runs the computation. The log files are removed after the state has been restored.SSaves the logged state of the current computation that has been accumulated using  , and then Xs using the passed parameter as the exit code. Note that all the computations before a  must be ; to have a consistent log state. The logs are saved in the logsX subdirectory of the current directory. Each thread's log is saved in a separate file.<Saves the accumulated logs of the current computation, like , but does not exit.Run the computation, write its result in a log in the parent computation and return the result. If the log already contains the result of this computation (`d from previous saved state) then that result is used instead of running the computation again.' can be used for computations inside a i computation. Once the parent computation is finished its internal (subcomputation) logs are discarded. & &None;=CV6eThe parse context contains either the string to be parsed or a computation that gives an stream of strings or both. First, the string is parsed. If it is empty, the stream is pulled for more.$set a stream of strings to be parsedset a string to be parsedsbring the data of a parse context as a lazy byteString to a parser and actualize the parse context with the result8bring the data of the parse context as a lazy byteString       !"#$%&'()(*++,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~(transient-0.6.0.1-6L2ilJHPYOiLJnTKkZLTPkTransient.InternalsTransient.IndeterminismTransient.EVarsTransient.LoggedTransient.ParseControl.Exception.Base onExceptionTransient.BaseTransient.BacktrackFinish Backtrack backtracking backStackExit StreamDataSMoreSLastSDoneSErrorRefAdditionalOperators**><**atEnd'<***atEnd RemoteStatus WasRemote WasParallelNoRemoteLogLogElemWaitExecVarHash LogEntriesCurrentPointerRecoverIDynamicIDynsLoggableEventFeventxcompfcompmfData mfSequencethreadIdfreeThparentchildren maxThreadlabelth LifeCycleAliveParentListenerDead TransientIOEventIdSDataTransIO TransientrunTransStateIOtshow!>noTrans emptyEventF runTransient runTransStategetContrunContrunCont'getContinuationscompose runClosurerunContinuationsetContinuationwithContinuation restoreStackrunContinuations readWithErrread' readsPrec'stop<| setEventContresetEventConttailsafe waitQSemB signalQSemBthreads oneThread labelState printBlock showThreadstopState showState processStates addThreads' addThreads freeThreads hookedThreads killChilds killBranch killBranch'getDatagetSDatagetStatesetData modifyData modifyData' modifyStatesetStatedelDatadelState setRState getRState delRStatetrysandbox genGlobalId rglobalIdgenId getPrevId waitEventsasyncsyncspawnsampleparallelloopfree hangThread killChildrenreactabduceoptionoption1optionfinputfinputinput'rcb addListener delListenerreads1 inputLoop rconsumed processLinestaykeepkeep'execCommandLineexit onNothingbackCutundoCutonBackonUndo registerBack registerUndoforwardretrynoFinishback backStateOfundoonFinish onFinish' initFinishfinish checkFinalize onException' exceptBack cutExceptionscontinuecatchtthrowt$fReadSomeException $fNumTransIO$fFractionalTransIO$fAlternativeTransIO$fMonoidTransIO$fMonadIOTransIO$fMonadTransIO$fFunctorTransIO$fMonadStateEventFTransIO$fReadIDynamic$fShowIDynamic$fMonadPlusTransIO$fApplicativeTransIO$fAdditionalOperatorsTransIO$fExceptionFinish $fEqLifeCycle$fShowLifeCycle $fReadLogElem $fShowLogElem $fShowLog$fEqRemoteStatus$fShowRemoteStatus$fShowStreamData$fReadStreamData $fShowFinishchoosechoose'group groupByTimecollectcollect'EVarnewEVar cleanEVarreadEVar writeEVar lastWriteEVarrestoresuspend checkpoint maybeFromIDynfromIDyntoIDynloggedreceivedparam ParseContextsetParseStreamsetParseStringstringmanyTill dropSpacesdropCharendline parseString tTakeWhile tTakeWhile'tTaketCharparsewithDatagiveDataghc-prim GHC.TypesTrueFalsebaseGHC.Baseempty Alternative<|>GHC.ListtailJustNothingGHC.IOcatch time-1.8.0.2 Data.Time.Clock.Internal.UTCDiff diffUTCTime