!8%      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$None "#,2=>?@AEXn  transient 4 represents a task in a task stream being generated.  transientMore tasks to come  transientThis is the last task  transientNo more tasks, we are done transientAn error occurred transientRun m a& discarding its result before running m b. transientRun m b1 discarding its result, after the whole task set m a is done. transientRun m b0 discarding its result, once after each task in m a3, and once again after the whole task set is done.% transient&Dynamic serializable data for logging.( transient7Constraint type synonym for a value that can be logged.+ transient:EventF describes the context of a TransientIO computation:- transientRNot yet consumed result (event) from the last asynchronous run of the computation/ transientList of continuations0 transient.State data accessed with get or put operations3 transientWhen %., threads are not killed using kill primitives4 transientThe parent of this thread5 transient%Forked child threads, used only when 3 is &6 transient8Maximum number of threads that are allowed to be created7 transient<Label the thread with its lifecycle state and a label stringF transientRun 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.H transient8Run a transient computation with a default initial stateI transient6Run a transient computation with a given initial stateK transientMGet the continuation context: closure, continuation, state, child threads etcL transientORun the closure and the continuation using the state data of the calling threadM transient>Run the closure and the continuation using its own state data.N transient2Warning: Radically untyped stuff. handle with careO transient Compose a list of continuations.P transientRun the closure (the x- in 'x >>= f') of the current bind operation.Q transientRun the continuation (the fD in 'x >>= f') of the current bind operation with the current state.R transient#Save a closure and a continuation (x and f in 'x >>= f').S transientvSave a closure and continuation, run the closure, restore the old continuation. | NOTE: The old closure is discarded.T transientURestore the continuations to the provided ones. | NOTE: Events are also cleared out.U transientRun 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 [ after the invocation.V transientMstop the current computation and does not execute any alternative computation[ transient 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.\ transientRun 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.] transientBSet the current closure and continuation for the current statement^ transientReset the closure and continuation. Remove inner binds than the previous computations may have stacked in the list of continuations. resetEventCont :: Maybe a -> EventF -> StateIO ()_ transientTotal variant of *5 that returns an empty list when given an empty list.b transientSets 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.c transientTerminate 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.d transientXAdd a label to the current passing threads so it can be printed by debugging calls like ff transient0Show the tree of threads hanging from the state.g transientcReturn the state of the thread that initiated the transient computation topState :: TransIO EventFh transientPfind the first computation state which match a filter in the subthree of statesi transientAReturn the state variable of the type desired for a thread numberj transientTexecute all the states of the type desired that are created by direct child threadsk transientNAdd n threads to the limit of threads. If there is no limit, the limit is set.l transientFEnsure that at least n threads are available for the current task set.m transientSDisable 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.n transientEnable 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 m.o transient1Kill all the child threads of the current thread.p transient'Kill the current thread and the childs.q transient*Kill the childs and the thread of an stater transientSame as s8 but with a more general type. If the data is found, a +! value is returned. Otherwise, a , value is returned.s transient|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)t transientSame as su transientuK stores a data item in the monad state which can be retrieved later using r or s. 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) v transientAccepts a function which takes the current value of the stored data type and returns the modified value. If the function returns ,) the value is deleted otherwise updated.w transientEither modify according with the first parameter or insert according with the second, depending on if the data exist or not. It returns the old value or the new value accordingly. runTransient $ do modifyData' (\h -> h ++ " world") "hello new" ; r <- getSData ; liftIO $ putStrLn r -- > "hello new" runTransient $ do setData "hello" ; modifyData' (\h -> h ++ " world") "hello new" ; r <- getSData ; liftIO $ putStrLn r -- > "hello world"x transientSame as modifyDatay transientSame as uz transient<Delete the data item of the given type from the monad state.{ transientSame as z| transientmutable state reference that can be updated (similar to STRef in the state monad) They are identified by his type. Initialized the first time it is set. transientRun 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 state transientGExecutes the computation and reset the state either if it fails or not. transientKgenerates an identifier that is unique within the current program execution transientwGenerator of identifiers that are unique within the current monadic sequence They are not unique in the whole program. transientA 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. transientRun an IO computation asynchronously carrying the result of the computation in a new thread when it completes. If there are no threads available, the async computation and his continuation is executed before any alternative computation. See  for notes on the return value. transientIForce 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. transient  spawn = freeThreads . waitEvents transientAn stream generator that run an IO computation periodically at the specified time interval. The task carries the result of the computation. A new result is generated only if the output of the computation is different from the previous one. See  for notes on the return value. transient[Run an IO action one or more times to generate a stream of tasks. The IO action returns a  . When it returns an   or   a new result is returned with the result value. If there are threads available, the res of the computation is executed in a new thread. If the return value is  V, the action is run again to generate the next result, otherwise task creation stop./Unless the maximum number of threads (set with bg) has been reached, the task is generated in a new thread and the current thread returns a void task. transient*Execute the IO action and the continuation transientDkill all the child threads associated with the continuation context transientFMake 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. transient:Runs the rest of the computation in a new thread. Returns ' to the current thread transient-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. transientinputf  removeafter sucessful or not  listener identifier  Maybe default value validationproc transientWaits 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. transient with a default value transientWait for the execution of ; and return the result or the exhaustion of thread activity transientRuns the transient computation in a child thread and keeps the main thread running until all the user threads exit or some thread .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/end transientSame 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 running transientvExit the main thread with a result, and thus all the Transient threads (and the application if there is no more code) transientIf the first parameter is ,D return the second parameter otherwise return the first parameter.. transientGDelete all the undo actions registered till now for the given track id. transient& for the default track; equivalent to  backCut (). transientfRun 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. transient& for the default track; equivalent to  onBack (). transientRegister 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. transientFor a given undo track type, stop executing more backtracking actions and resume normal execution in the forward direction. Used inside an undo action. transient+ for the default undo track; equivalent to  forward (). transient\Abort finish. Stop executing more finish actions and resume normal execution. Used inside  actions. transientStart the undo process for a given undo track identifier type. Performs all the undo actions registered for that type in reverse order. An undo action can use u to stop the undo process and resume forward execution. If there are no more undo actions registered, execution stop transienta backpoint is a location in the code where callbacks can be installed and will be called when the backtracing pass trough that point. Normally used for exceptions. transient!install a callback in a backPoint transient+ for the default undo track; equivalent to back (). transientYClear 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. transientuRun 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. transient@Execute all the finalization actions registered up to the last G, in reverse order and continue the execution. Either an exception or , can be transient+trigger finish when the stream of data ends transientInstall 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  transientlset an exception point. Thi is a point in the backtracking in which exception handlers can be inserted with  it is an specialization of  for exceptions.bWhen an exception backtracking reach the backPoint it executes all the handlers registered for it.yUse case: suppose that when a connection fails, you need to stop a process. This process may not be directly involved in the connection. Perhaps it was initiated after the socket is being read so an exception will not backtrack trough the process, since it is downstream, not upstream. The process may be even unrelated to the connection, in other branch of the computation.'in this case you only need to create a + before stablishin the connection, and use @ to set a handler that will be called when the connection fail. transient6Delete all the exception handlers registered till now. transientUse it inside an exception handler. it stop executing any further exception handlers and resume normal execution from this point on. transient'catch an exception in a Transient blockThe semantic is the same than -C but the computation and the exception handler can be multirhreaded transientIthrow an exception in the Transient monad there is a difference between . and a since the latter preserves the state, while the former does not. Any exception not thrown with  does not preserve the state. main= keep $ do onException $ \(e:: SomeException) -> do v <- getState <|> return "hello" liftIO $ print v setState "world" throw $ ErrorCall "asdasd"%the latter print "hello". If you use  instead, it prints "world"    !"#$%&'()*+,76543210/.-8<;:9=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~DEC@AB?>=8<;:9+,76543210/.-FGHIJKLMNOPQRSTUVWX)*YZ(%&'$#"! [\]^_`abcdefghijklmnopqrstuvwxyz{|}~   111NoneX5C transientKConverts a list of pure values into a transient task set. You can use the b& primitive to control the parallelism. transienttransmit the end of stream transientSame as , slower in some cases transient/Collect the results of a task set in groups of n elements. transientCollect 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. transientLike 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.0 transientinsert  > response everytime there is a timeout since the last responseNone2M transientcreates 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 transient(delete al the subscriptions for an evar. transientread 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  transientQupdate the EVar and execute all readEVar blocks with "last in-first out" priority transient write the EVar and drop all the  handlers.It is like a combination of  and NoneXN52 =@[bclmnorstuvwxyz{|~2@=[ usrzvwyt{~|xblmnco None2EXP None=?EXb0 transientReads 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. transientSSaves 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. transient<Saves the accumulated logs of the current computation, like , but does not exit. transientRun 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=>?EX transientThe 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. transient$set a stream of strings to be parsed transientset a string to be parsed transient-succeed if read the string given as parameter transientfast search for a token transientread an Integer transient read an Int transient7read many results with a parser (at least one) until a end parser succeed. transient-take characters while they meet the condition transientItake characters while they meet the condition and drop the next character transienttake n characters  transientdrop n characters transient read a char  transient2verify that the next character is the one expected! transientbring the lazy byteString state to a parser and actualize the byteString state with the result The tuple that the parser should return should be : (what it returns, what should remain to be parsed)" transient8bring the data of the parse context as a lazy byteString# transientTrue if the stream has finished$ transientdChain two parsers. The motivation is to parse a chunked HTTP response which contains JSON messages.If the REST response is infinite and contains JSON messages, I have to chain the dechunk parser with the JSON decoder of aeson, to produce a stream of aeson messages. Since the boundaries of chunks and JSON messages do not match, it is not possible to add a decode to the monadic pipeline. Since the stream is potentially infinite and/or the messages may arrive at any time, I can not wait until all the input finish before decoding the messages.iI need to generate a ByteString stream with the first parser, which is the input for the second parser. WThe first parser wait until the second consume the previous chunk, so it is pull-based.6many parsing stages can be chained with this operator.BThe output is nondeterministic: it can return 0, 1 or more results example: https://t.co/fmx1uE2SUd-      !"#$-      !"#$1         !"#$%&'()*)+,,--./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%#$&'()'(*'(+',-'./'.0'12'3456789&transient-0.6.3-KFnZ55zaZHAEyOgVZuyI7TTransient.InternalsTransient.IndeterminismTransient.EVarsTransient.LoggedTransient.ParseControl.Exception.Base onExceptionTransient.BaseTransient.BacktrackFinish BackPoint Backtrack backtracking backStackExit StreamDataSMoreSLastSDoneSErrorRefAdditionalOperators**><**atEnd'<***atEnd RemoteStatus WasRemote WasParallelNoRemoteLogLogElemWaitExecVarHash LogEntriesCurrentPointerRecoverIDynamicIDynsLoggable ParseErrorEventFeventxcompfcompmfData mfSequencethreadIdfreeThparentchildren maxThreadlabelth LifeCycleAliveParentListenerDead TransientIOEventIdSDataTransIO TransientrunTransStateIOtshow!>noTrans emptyEventF runTransient runTransStateemptyIfNothinggetContrunContrunCont'getContinuationscompose runClosurerunContinuationsetContinuationwithContinuation restoreStackrunContinuationsfullStopmappendt readWithErrread' readsPrec'stop<| setEventContresetEventConttailsafe waitQSemB signalQSemBthreads oneThread labelState printBlock showThreadstopState findStategetStateFromThread processStates addThreads' addThreads freeThreads hookedThreads killChilds killBranch killBranch'getDatagetSDatagetStatesetData modifyData modifyData' modifyStatesetStatedelDatadelState setRStategetRData getRState delRStatetrysandbox genGlobalId rglobalIdgenId getPrevId waitEventsasyncsyncspawnsampleparallelloopfree hangThread killChildrenreactabduceoptionoption1optionfinputfinputinput'rcb addListener delListenerreads1read1rprompt inputLoop rconsumedlineprocessmode processLinestaykeepkeep'execCommandLineexit onNothingbackCutundoCutonBackonUndo registerBack registerUndoforwardretrynoFinishback backStateOf backPoint onBackPointundoonFinish onFinish' initFinishfinish checkFinalizeexceptionPointonExceptionPoint onException' exceptBack cutExceptionscontinuecatchtthrowt$fReadSomeException $fNumTransIO$fFractionalTransIO$fAlternativeTransIO$fSemigroupTransIO$fMonoidTransIO$fMonadIOTransIO$fMonadTransIO$fFunctorTransIO$fMonadStateEventFTransIO$fExceptionParseError$fReadIDynamic$fShowIDynamic$fMonadPlusTransIO$fApplicativeTransIO$fAdditionalOperatorsTransIO$fFunctorStreamData$fExceptionFinish $fEqLifeCycle$fShowLifeCycle$fShowParseError $fReadLogElem $fShowLogElem $fShowLog$fEqRemoteStatus$fShowRemoteStatus$fShowStreamData$fReadStreamData $fShowFinishchoose chooseStreamchoose'groupcollectcollect' groupByTimeEVarnewEVar cleanEVarreadEVar writeEVar lastWriteEVarrestoresuspend checkpoint maybeFromIDynfromIDyntoIDynloggedreceivedparam ParseContextsetParseStreamsetParseStringwithParseStringstringtDropUntilTokentTakeUntilTokenintegerintmanyTill chainManyTillbetweensymbolparensbracesanglesbracketssemicommadotcolonsepBysepBy1 chainSepBy chainSepBy1 chainManycommaSepsemiSep commaSep1semiSep1 dropSpacesdropTillEndOfLine parseString tTakeWhile tTakeWhile'just1tTaketDropanyChartCharwithDatagiveDataisDone|-ghc-prim GHC.TypesTrueFalsebaseGHC.Baseempty Alternative<|>GHC.Listtail GHC.MaybeJustNothingGHC.IOcatch GHC.Exceptionthrow time-1.8.0.2 Data.Time.Clock.Internal.UTCDiff diffUTCTimeburst