!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{ | } ~                   (c) Tim Watson 2017BSD3 (see the file LICENSE)%Tim Watson <watson.timothy@gmail.com> experimental#non-portable (requires concurrency)None !"05MT We hold timers in 2 states, each described by a Delay. isActive = isJust . mtSignal the TimerRef is optional since we only use the Timer module from extras when we're unable to registerDelay (i.e. not running under -threaded)bUsed during STM reads on Timers and to implement blocking. Since timers can be associated with a TimerKeyE, the second constructor for this type yields a key indicating whic Timerg it refers to. Note that the user is responsible for establishing and maintaining the mapping between Timers and their keys.>A key for storing timers in prioritised process backing state.True if a Timer is currently active.Creates a default Timer which is inactive. Starts a Timer Will use the GHC  registerDelay API if rtsSupportsBoundThreads == True Stops a previously started Timer. Has no effect if the Timer is inactive. Clears and restarts a Timer. 5Clears/cancels a running timer. Has no effect if the Timer is inactive.  Creates a Match^ for a given timer, for use with Cloud Haskell's messaging primitives for selective receives. &Create a match expression for a given Timer:. When the timer expires (i.e. the "TVar Bool" is set to True), the Match will return Yield i , where i is the given TimerKey.*As "matchKey", but instead of a returning Yield i, the generated Match= handler evaluates the first argument - and expression from TimerKey to Process Message - to determine its result.Reads a given  TVar Bool for a timer, and returns  STM TimedOut) once the variable is set to true. Will retry in the meanwhile.     Safe  None/059;<=?ADINORTTStores the functions that determine runtime behaviour in response to incoming messages and a policy for responding to unhandled messages.(functions that handle call/cast messages,functions that handle non call/cast messages4functions that handle control channel and STM inputs"functions that handle exit signals a function that handles timeouts4a function that is run just before the process exits#how to deal with unhandled messagesVPolicy for handling unexpected messages, i.e., messages which are not sent using the  or cast0 APIs, and which are not handled by any of the  handleInfo handlers.stop immediately, giving  ExitOther UnhandledInput as the reason*forward the message to the given recipient )log messages, then behave identically to Drop!(dequeue and then drop/ignore the message"A ProcessDefinition decorated with DispatchPriority for certain input domains.(For a "+, this policy determines for how long the  receive looph should continue draining the process' mailbox before processing its received mail (in priority order).If a prioritised managed process+ is receiving a lot of messages (into its real; mailbox), the server might never get around to actually processing its inputs. This (mandatory) policy provides a guarantee that eventually (i.e., after a specified number of received messages or time interval), the server will stop removing messages from its mailbox and process those it has already received.+#Dispatcher for prioritised handlers0%Priority of a message, encoded as an Int3bDefines the means of dispatching messages from external channels (e.g. those defined in terms of ControlChannel , and STM actions) to a handler.6>Defines the means of dispatching inbound messages to a handler80Provides dispatch for any exit signal - returns  for unhandled exceptions;)Provides dispatch for any input, returns  for unhandled messages.>.Provides dispatch for channels and STM actionsGAProvides dispatch from cast and call messages to a typed handler.LEProvides dispatch from a variety of inputs to a typed filter handler.U$Given as the result of evaluating a DispatchFilterU. This type is intended for internal use. For an API for working with filters, see 3Control.Distributed.Process.ManagedProcess.Priority.[The writable end of a ^.^<Provides a means for servers to listen on a separate, typed control^ channel, thereby segregating the channel from their regular (and potentially busy) mailbox.a-An expression used to handle process timeoutsb0An expression used to handle process terminationc9An expression used to initialise a process with its statedAn expression used to handle a channel message in a stateless processeAn expression used to handle a channel messagef An expression used to handle an info messagegAn expression used to handle a cast messagehAn expression used to handle a call message ignoring server stateiAn expression used to handle a call. message where the reply is deferred via the j9An expression used to ignore server state during handlingk<An expression used to handle a message and providing a replyl&An expression used to handle a messagemJAn action (server state transition) causing a reply to a caller, in the Process monadn+An action (server state transition) in the Process monado Informs a shutdown handler] of whether it is running due to a clean shutdown, or in response to an unhandled exception.p*given when an ordered shutdown is underwayrWraps a predicate that is used to determine whether or not a handler is valid based on some combination of the current process state, the type and/or value of the input message or both.s predicated on the process state and the messaget$predicated on the process state onlyu$predicated on the input message onlyv+Returned from handlers for the synchronous ( protocol, encapsulates the reply data andC the action to take after sending the reply. A handler can return NoReply! if they wish to ignore the call.zThe action taken by a process after a handler has run and its updated state. See "Control.Distributed.Process.ManagedProcess.Server.continue" "Control.Distributed.Process.ManagedProcess.Server.timeoutAfter" "Control.Distributed.Process.ManagedProcess.Server.hibernate" "Control.Distributed.Process.ManagedProcess.Server.stop" "Control.Distributed.Process.ManagedProcess.Server.stopWith"Also see "Control.Distributed.Process.Management.Priority.act" and "Control.Distributed.Process.ManagedProcess.Priority.runAfter".9And other actions. This type should not be used directly.|run the given activity}evaluate an expression~"continue with (possibly new) state#timeout if no messages are receivedhibernate for delaystop the process, giving  ExitReasonstop the process with  ExitReason, with updated state&changes the current process definition1StateT based monad for prioritised process loops.&Prioritised process state, held as an IORef.-Internal state of a prioritised process loop. Map from TimerKey to (Timer, Message).7Internal priority queue, used by prioritised processes..Represent a max-backlog from RecvTimeoutPolicyReturn type for and c expression.Sent to a consumer of the callR API when a server filter expression explicitly rejects an incoming call message.Response type for the call APIMessage: type used internally by the call, cast, and rpcChan APIs. Wraps a consumer of the call APIwrapper for a  MonitorRef Retrieve the  Recipient for a CallRef. Retrieve the CallId for a CallRef. Creates a CallRef for the given  Recipient and CallId Retrieve the  Recipient from a Message . If the supplied message is a cast or chan message will evaluate to Nothing , otherwise Just ref. Reject a call) message with the supplied string. Sends  CallRejected% to the recipient if the input is a  CallMessage , otherwise has no side effects.Run an action in the  GenProcess monad.Lift an action in the Process monad to  GenProcess. Lift an IO action directly into  GenProcess, liftIO = lift . Process.LiftIO.True if the  ExitState is  CleanShutdown , otherwise False.Evaluates to the s state datum in the given  ExitState.Creates a new ^.5Obtain an opaque expression for communicating with a ^.The send part of the call+ client-server interaction. The resulting CallRefo can be used to identify the corrolary response message (if one is sent by the server), and is unique to this  call-reply pair. Version of initCall that utilises "unsafeSendTo".PWait on the server's response after an "initCall" has been previously been sent.This function does not trap asynchronous exceptions. !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~! "#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrtsuvwxyz{|}~rstuz{|}~vwxynmlkgjihfedcbopqa !012+,-.///LMNOPQRSTUVWXYZ"#$%&'()*^_`[\]GHIJJK>?@ABCDEF;<=89:67345N !"#$%&'()*+,-.///0123456789:;<=>?@ABCDEFGHIJJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz {|}~ (c) Tim Watson 2012 - 2017BSD3 (see the file LICENSE)%Tim Watson <watson.timothy@gmail.com> experimental#non-portable (requires concurrency)NoneAMT2 Creates a r, from a function that takes a process state a and an input message b and returns a 7 indicating whether the associated handler should run. Create a r, from a function that takes a process state a and returns a 6 indicating whether the associated handler should run. Creates a r- from a function that takes an input message m and returns a 6 indicating whether the associated handler should run.,Reject the message we're currently handling.GReject the message we're currently handling, giving an explicit reason.;Instructs the process to send a reply and continue running.&Instructs the process to send a reply and evaluate the z..Instructs the process to skip sending a reply and evaluate a z>Continue without giving a reply to the caller - equivalent to *, but usable in a callback passed to the  family of functions.hHalt process execution during a call handler, without paying any attention to the expected return type.AInstructs the process to continue running and receiving messages. Version of 8 that can be used in handlers that ignore process state.?Instructs the process loop to wait for incoming messages until B is exceeded. If no messages are handled during this period, the timeoute handler will be called. Note that this alters the process timeout permanently such that the given Delay" will remain in use until changed. Note that timeoutAfter NoDelayk will cause the timeout handler to execute immediately if no messages are present in the process' mailbox. Version of 8 that can be used in handlers that ignore process state. <action (\(TimeoutPlease duration) -> timeoutAfter_ duration)Instructs the process to  hibernate for the given }. Note that no messages will be removed from the mailbox until after hibernation has ceased. This is equivalent to calling  threadDelay. Version of 8 that can be used in handlers that ignore process state. 5action (\(HibernatePlease delay) -> hibernate_ delay)2The server loop will execute against the supplied , allowing the process to change its behaviour (in terms of message handlers, exit handling, termination, unhandled message policy, etc)LInstructs the process to terminate, giving the supplied reason. If a valid * is installed, it will be called with the 8 returned from this call, along with the process state.As 9, but provides an updated state for the shutdown handler. Version of 8 that can be used in handlers that ignore process state. )action (\ClientError -> stop_ ExitNormal)%Sends a reply explicitly to a caller. replyTo = sendToSends a reply to a  (for use in  et al). replyChan = sendChan Constructs a call handler from a function in the R monad. The handler expression returns the reply, and the action will be set to . 0handleCall_ = handleCallIf_ $ input (const True) Constructs a call* handler from an ordinary function in the < monad. This variant ignores the state argument present in  and  and is therefore useful in a stateless server. Messges are only dispatched to the handler if the supplied condition evaluates to TrueSee  Constructs a call handler from a function in the 1 monad. > handleCall = handleCallIf (const True) Constructs a call* handler from an ordinary function in the  monad. Given a function +f :: (s -> a -> Process (ProcessReply b s)), the expression  handleCall f will yield a  Dispatcher for inclusion in a  Behaviour specification for the  GenProcessV. Messages are only dispatched to the handler if the supplied condition evaluates to True. A variant of ! that ignores the state argument. A variant of ! that ignores the state argument.As  but passes the = to the handler function. This can be useful if you wish to  reply laterI to the caller by, e.g., spawning a process to do some work and have it replyTo caller response6 out of band. In this case the callback can pass the 5 to the worker (or stash it away itself) and return .As + but only runs the handler if the supplied r evaluates to True.Creates a handler for a  typed channel- RPC style interaction. The handler takes a  SendPort b4 to reply to, the initial input and evaluates to a zD. It is the handler code's responsibility to send the reply to the SendPort.As C, but only evaluates the handler if the supplied condition is met. A variant of ! that ignores the state argument. A variant of ! that ignores the state argument. Constructs a cast* handler from an ordinary function in the 2 monad. > handleCast = handleCastIf (const True) Constructs a cast* handler from an ordinary function in the  monad. Given a function *f :: (s -> a -> Process (ProcessAction s)), the expression  handleCall f will yield a G for inclusion in a  Behaviour specification for the  GenProcess.$Creates a generic input handler for STM, actions, from an ordinary function in the  monad. The STM at action tells the server how to read inputs, which when presented are passed to the handler in the same manner as  handleInfo messages would be.kNote that messages sent to the server's mailbox will never match this handler, only data arriving via the STM a action will.Notably, this kind of handler can be used to pass non-serialisable data to a server process. In such situations, the programmer is responsible for managing the underlying STM5 infrastructure, and the server simply composes the STM aC action with the other reads on its mailbox, using the underlying matchSTM API from distributed-process.HNB: this function cannot be used with a prioristised process definition. Version of handleExternal that ignores state.Handle call( style API interactions using arbitrary STM actions. The usual  CallHandler is preceded by an stm action that, when evaluated, yields a value, and a second expression that is used to send a reply back to the caller. The corrolary client API is callSTM. Constructs a control channel! handler from a function in the : monad. The handler expression returns no reply, and the control message% is treated in the same fashion as a cast. <handleControlChan = handleControlChanIf $ input (const True) Version of  that ignores the server state. Version of  that ignores the server state. Version of  that ignores the server state.Constructs an action handler. Like  this can handle both cast and call4 messages, but you won't know which you're dealing with. This can be useful where certain inputs require a definite action, such as stopping the server, without concern for the state (e.g., when stopping we need only decide to stop, as the terminate handler can deal with state cleanup etc). For example: -action (MyCriticalSignal -> stop_ ExitNormal)Constructs a handler for both call and cast messages. .handleDispatch = handleDispatchIf (const True)Constructs a handler for both call and cast_ messages. Messages are only dispatched to the handler if the supplied condition evaluates to Truex. Handlers defined in this way have no access to the call context (if one exists) and cannot therefore reply to calls.FCreates a generic input handler (i.e., for received messages that are not sent using the cast or call) APIs) from an ordinary function in the  monad.Handle completely raw input messages.  Creates an  exit handlere scoped to the execution of any and all the registered call, cast and info handlers for the process. Conditional version of  handleExit87predicate that must be satisfied for the handler to run+a function from an input message to a reply7predicate that must be satisfied for the handler to runBa reply yielding function over the process state and input message7predicate that must be satisfied for the handler to runJa reply yielding function over the process state, sender and input message7predicate that must be satisfied for the handler to runDan action yielding function over the process state and input message(the receiving end of the control channelDan action yielding function over the process state and input message7predicate that must be satisfied for the handler to run'a function from the input message to a stateless action, cf 'a function from the input message to a stateless action, cf   2  2  8  (c) Tim Watson 2012 - 2017BSD3 (see the file LICENSE)%Tim Watson <watson.timothy@gmail.com> experimental#non-portable (requires concurrency)None0AIT The result of a safe  handler's execution. continue executing #timeout if no messages are receivedhibernate (i.e., sleep)!stop/terminate the server processThe result of a call handler's execution.reply with the given term+reply with the given term and enter timeout'reply with the given term and hibernate&stop the process with the given reasonORestricted (i.e., pure, free from side effects) execution environment for callcastinfo handlers to execute in.3Log a trace message using the underlying Process's sayGet the current process statePut a new process state state7Apply the given expression to the current process state;Instructs the process to send a reply and continue running.>Continue without giving a reply to the caller - equivalent to *, but usable in a callback passed to the ! family of functions.hHalt process execution during a call handler, without paying any attention to the expected return type.AInstructs the process to continue running and receiving messages.?Instructs the process loop to wait for incoming messages until B is exceeded. If no messages are handled during this period, the timeoute handler will be called. Note that this alters the process timeout permanently such that the given Delay" will remain in use until changed.Instructs the process to  hibernate for the given . Note that no messages will be removed from the mailbox until after hibernation has ceased. This is equivalent to evaluating liftIO . threadDelay. LInstructs the process to terminate, giving the supplied reason. If a valid * is installed, it will be called with the 8 returned from this call, along with the process state.!tA version of "Control.Distributed.Process.ManagedProcess.Server.handleCall" that takes a handler which executes in ."vA version of "Control.Distributed.Process.ManagedProcess.Server.handleCallIf" that takes a handler which executes in .#tA version of "Control.Distributed.Process.ManagedProcess.Server.handleCast" that takes a handler which executes in .$vA version of "Control.Distributed.Process.ManagedProcess.Server.handleCastIf" that takes a handler which executes in .%tA version of "Control.Distributed.Process.ManagedProcess.Server.handleInfo" that takes a handler which executes in .&Handle exit signals'Handle timeouts;TODO MonadTrans instance? lift :: (Monad m) => m a -> t m a#    !"#$7predicate that must be satisfied for the handler to runDan action yielding function over the process state and input message%&'    !"#$%&'   !"#$%&'     !"#$%&'(c) Tim Watson 2012 - 2017BSD3 (see the file LICENSE)%Tim Watson <watson.timothy@gmail.com> experimental#non-portable (requires concurrency)NoneANT -Send a control message over a [. This version of shutdown uses unsafe primitives..ESend a signal instructing the process to terminate. This version of shutdown uses unsafe primitives./Make a synchronous call - uses unsafe primitives.0Safe version of /I that returns information about the error if the operation fails - uses unsafe primitives.1 Version of 0 that returns  if the operation fails. Uses unsafe primitives.20Make a synchronous call, but timeout and return NothingH if a reply is not received within the specified time interval - uses unsafe primitives.3 Block for  TimeInterval waiting for any matching  CallResponse4Invokes /  out of band', and returns an "async handle." Uses unsafe primitives.5Sends a cast% message to the server identified by server - uses unsafe primitives.6Sends a channel% message to the server and returns a  ReceivePort - uses unsafe primitives.7A synchronous version of 6.8A safe version of 7, which returns Left ExitReason if the call fails. -./012345678 -./012345678 -./012345678 -./012345678None!"05<=AILMOT!QMaps filters to an action that can take place outside of a expect/recieve block.Maps handlers to a dynamic action that can take place outside of a expect/recieve block. This is used by the prioritised process loop.9%Evaluate the given function over the ProcessState s( for the caller, and return the result.:Modify our state.;:Modify our state and return a value (potentially from it).<Set the current process state.Set the mailbox draining timer.=YSet the user timeout applied whilst a prioritised process loop is in a blocking receive.>Add a  user timer, bound to the given datum.? Remove a  user timer, for the given key.!Consume the timer with the given TimerKey!. The timer is removed from the  ProcessStateU and given to the supplied expression, whose evaluation is given back to the caller.@The ProcessDefinition for the current loop..The list of prioritisers for the current loop.A)The list of filters for the current loop.BLEvaluates to the user defined state for the currently executing server loop.CEvaluates to the UnhandledMessagePolicy for the current loop.D Returns a read only view on the internal priority queue.EThe Timer for the system timeout. See  drainTimeout.tThe policy for the system timeout. This is used to determine how the loop should limit the time spent draining the real3 process mailbox into our internal priority queue.FThe Delay for the  drainTimeout.G$The current (user supplied) timeout.-Update and store the internal priority queue.HEvaluate any matching  info handler5 with the supplied datum after waiting for at least  TimeInterval'. The process state (for the resulting Action s8) is also given and the process loop will go on as per Server.continue.6Informally, evaluating this expression (such that the Action is given as the result of a handler or filter) will ensure that the supplied message (datum) is availble for processing no sooner than  TimeInterval.&Currently, this expression creates an Action| that triggers immediate evaluation in the process loop before continuing with the given state. The process loop stores a  user timeoutv for the given time interval, which is trigerred like a wait/drain timeout. This implementation is subject to change.I Produce an Action s that, if it is the result of a handler, will cause the server loop to evaluate the supplied expression. This is given in the  GenProcess1 monad, which is intended for internal use only.JEvaluate an expression in the  monad.K Starts a timer and adds it as a  user timeout.L3Dequeue a message from the internal priority queue.MXPeek at the next available message in the internal priority queue, without removing it.N:Push a message to the head of the internal priority queue.O=Enqueue a message to the back of the internal priority queue.Enqueue a message in the internal priority queue. The given message will be evaluated by all the supplied prioritisers, and if none match it, then it will be assigned the lowest possible priority (i.e. put at the back of the queue).PPrioritised process loop.Evaluating this function will cause the caller to enter a server loop, constantly reading messages from its mailbox (and/or other supplied control planes) and passing these to handler functions in the supplied process definition. Only when it is determined that the server process should terminate - either by the handlers deciding to stop the process, or by an unhandled exit signal or other form of failure condition (e.g. synchronous or asynchronous exceptions).7ensureIOManagerIsRunning before evaluating this loop...QManaged process loop.Evaluating this function will cause the caller to enter a server loop, constantly reading messages from its mailbox (and/or other supplied control planes) and passing these to handler functions in the supplied process definition. Only when it is determined that the server process should terminate - either by the handlers deciding to stop the process, or by an unhandled exit signal or other form of failure condition (e.g. synchronous or asynchronous exceptions).-9:;<=>?@ABCDEFGHIJKLMNOPQRSTU9:;<=>?@ABCDEFGHIJKLMNOPQQPGEFB@ACD9;:=<MNOL>?JIKH+9:;<=>?@ABCDEFGHIJKLMNOPQRSTU(c) Tim Watson 2012 - 2017BSD3 (see the file LICENSE)%Tim Watson <watson.timothy@gmail.com> experimental#non-portable (requires concurrency)None !"/ACMT V,Reject the message we're currently handling.WGReject the message we're currently handling, giving an explicit reason.X;Instructs the process to send a reply and continue running.Y&Instructs the process to send a reply and evaluate the z.Z.Instructs the process to skip sending a reply and evaluate a z[hHalt process execution during a call handler, without paying any attention to the expected return type.\AInstructs the process to continue running and receiving messages.]?Instructs the process loop to wait for incoming messages until B is exceeded. If no messages are handled during this period, the timeoute handler will be called. Note that this alters the process timeout permanently such that the given Delay" will remain in use until changed. Note that timeoutAfter NoDelayk will cause the timeout handler to execute immediately if no messages are present in the process' mailbox.^Instructs the process to  hibernate for the given }. Note that no messages will be removed from the mailbox until after hibernation has ceased. This is equivalent to calling  threadDelay._2The server loop will execute against the supplied , allowing the process to change its behaviour (in terms of message handlers, exit handling, termination, unhandled message policy, etc)`LInstructs the process to terminate, giving the supplied reason. If a valid shutdownHandler* is installed, it will be called with the 8 returned from this call, along with the process state. VWXYZ[\]^_`&9:;<=>?@ABCDEFGHIJKLMNOPQVWXYZ[\]^_`&XYZ\]^`VW_[QPGEFB@ACD9;:=<MNOL>?JIKH VWXYZ[\]^_`(c) Tim Watson 2012 - 2017BSD3 (see the file LICENSE)%Tim Watson <watson.timothy@gmail.com> experimental#non-portable (requires concurrency)None !"/ACMT>Represents a pair of expressions that can be used to define a DispatchFilter.<A pure handler, usable where the target handler is based on  handleInfo<An API handler, usable where the target handler is based on handle{Call, Cast, RpcChan};A raw handler, usable where the target handler is based on  handleRawA safe wrapperLSent to a caller in cases where the server is rejecting an API input and a  Recipient is available (i.e. a call message handling filter).aCreate a filter from a  FilterHandler.b'A raw filter (targetting raw messages).cGA raw filter that ignores the server state in its condition expression.dAn API filter (targetting call, cast, and chan messages).eHAn API filter that ignores the server state in its condition expression.f<An info filter (targetting info messages of a specific type)gIAn info filter that ignores the server state in its condition expression.hAs ia, but as applied to api messages (i.e. those originating from call as cast client interactions).i-Given a check expression, if it evaluates to True for some input, then do not dequeue the message until after any matching handlers have successfully run, or the the unhandled message policy is chosen if none match. Thus, if an exit signal (async exception) terminates execution of a handler, and we have an installed exit handler which allows the process to continue running, we will retry the input in question since it has not been fully dequeued prior to the exit signal arriving.jAs i, but matches on a raw message.kLCreate a filter expression that will reject all messages of a specific type.lBCreate a filter expression that will crash (i.e. stop) the server.m A version of reject$ that deals with API messages (i.e. call, cast, etc) and in the case of a callR interaction, will reject the messages and reply to the sender accordingly (with  CallRejected).n9Modify the server state every time a message is recieved.oAMotify the server state when messages of a certain type arrive...p<Refuse messages for which the given expression evaluates to True.qEnsure that the server state is consistent with the given expression each time a message arrives/is processed. If the expression evaluates to True# then the filter will evaluate to FilterOk , otherwise  FilterStop1 (which will cause the server loop to stop with ExitOther filterFail).rAs ensure but runs in the Process( monad, and matches only inputs of type m.seSets an explicit priority from 1..100. Values > 100 are rounded to 100, and values < 1 are set to 0.t6Prioritise a call handler, ignoring the server's stateuPrioritise a call handlerv6Prioritise a cast handler, ignoring the server's statewPrioritise a cast handlerx7Prioritise an info handler, ignoring the server's stateyPrioritise an info handler*abcdefghijklmnopqrstuvwxy*LU<=>@ABCGHIKMNabcdefghijklmnopqrstuvwxy*utwvyxsabcdefgpkmnolqrULihjHGB@AC=<MN>IK abcdefghijklmnopqrstuvwxy (c) Tim Watson 2012 - 2017BSD3 (see the file LICENSE)%Tim Watson <watson.timothy@gmail.com> experimental#non-portable (requires concurrency)NoneAT {Send a control message over a [.|8Send a signal instructing the process to terminate. The  receive loop4 which manages the process mailbox will prioritise Shutdown` signals higher than any other incoming messages, but the server might be busy (i.e., still in the process of excuting a handler) at the time of sending however, so the caller should not make any assumptions about the timeliness with which the shutdown signal will be handled. If responsiveness is important, a better approach might be to send an  exit signal with  as the reason. An exit signal will interrupt any operation currently underway and force the running process to clean up and terminate.}dMake a synchronous call - will block until a reply is received. The calling process will exit with  if the calls fails..NOTE: this function does not catch exceptions!~Safe version of } that returns information about the error if the operation fails. If the calling process dies (that is, forces itself to exit such that an exit signal arises with ExitOther String) then evaluation will return Left exitReason. and the explanation will be stashed away as (ExitOther String)..NOTE: this function does not catch exceptions!The safety^ of the name, comes from carefully handling situations in which the server dies while we're waiting for a reply. Notably, exit signals from other processes, kill signals, and both synchronous and asynchronous exceptions can still terminate the caller abruptly. To avoid this consider masking or evaluating within your own exception handling code. Version of ~ that returns e if the operation fails. If you need information about *why* a call has failed then you should use ~ or combine  catchExit and call instead..NOTE: this function does not catch exceptions!8In fact, this API handles fewer exceptions than it's relative, "safeCall". Notably, exit signals, kill signals, and both synchronous and asynchronous exceptions can still terminate the caller abruptly. To avoid this consider masking or evaluating within your own exception handling code (as mentioned above).0Make a synchronous call, but timeout and return Nothing@ if a reply is not received within the specified time interval.qIf the result of the call is a failure (or the call was cancelled) then the calling process will exit, with the y given as the reason. If the call times out however, the semantics on the server side are undefined, i.e., the server may or may not successfully process the request and may (or may not) send a response at a later time. From the callers perspective, this is somewhat troublesome, since the call result cannot be decoded directly. In this case, the "flushPendingCalls" API mayJ be used to attempt to receive the message later on, however this makes no attempt whatsoever to guarantee which call response will in fact be returned to the caller. In those semantics are unsuited to your application, you might choose to exit or die2 in case of a timeout, or alternatively, use the  API and associated  waitTimeout function (in the  Async APIS), which takes a re-usable handle on which to wait (with timeouts) multiple times.1Attempt to flush out any pending call responses. Invokes }  out of band, and returns an  async handle.Sends a cast% message to the server identified by server=. The server will not send a response. Like Cloud Haskell's , primitive, cast is fully asynchronous and  never fails - therefore Ning to a non-existent (e.g., dead) server process will not generate an error.Sends a channel% message to the server and returns a  ReceivePortq on which the reponse can be delivered, if the server so chooses (i.e., the might ignore the request or crash).A synchronous version of .A safe version of , which returns Left ExitReason if the call fails.>Manages an rpc-style interaction with a server process, using STMW actions to read/write data. The server process is monitored for the duration of the calln. The stm write expression is passed the input, and the read expression is evaluated and the result given as Right b or Left ExitReason1 if a monitor signal is detected whilst waiting.%Note that the caller will exit (with ExitOther String*) if the server address is un-resolvable.rA note about scheduling and timing guarantees (or lack thereof): It is not possibly to guarantee the contents of  ExitReason in cases where this API fails due to server exits/crashes. We establish a monitor prior to evaluating the stm writer action, however monitor is asychronous and we've no way to know whether or not the scheduler will allow monitor establishment to proceed first, or the stm transaction. As a result, assuming that your server process can diefail(exit on evaluating the read end of the STM write we perform here (and we assume this is very likely, since we apply no safety rules and do not even worry about serializing thunks passed from the client's thread), it is just as likely that in the case of failure you will see a reason such as  ExitOther  DiedUnknownIdX due to the server process crashing before the node controller can establish a monitor.As unpleasant as this is, there's little we can do about it without making false assumptions about the runtime. Cloud Haskell's semantics guarantee us only that we will see some monitor signal in the event of a failure here. To provide a more robust error handling, you can catch/trap failures in the server process and return a wrapper reponse datum here instead. This will still be subject to the failure modes described above in cases where the server process exits abnormally, but that will at least allow the caller to differentiate between expected and exceptional failure conditions. {|}~ {|}~ {|}~ {|}~ (c) Tim Watson 2012 - 2017BSD3 (see the file LICENSE)%Tim Watson <watson.timothy@gmail.com> experimental#non-portable (requires concurrency)NoneAT  Starts the message handling loop for a managed process configured with the supplied process definition, after calling the init handler with its initial arguments. Note that this function does not return until the server exits. Starts the message handling loop for a prioritised managed process, configured with the supplied process definition, after calling the init handler with its initial arguments. Note that this function does not return until the server exits. Starts the message handling loop1 for a managed process, configured with a typed control channel{. The caller supplied expression is evaluated with an opaque reference to the channel, which must be passed when calling handleControlChanf. The meaning and behaviour of the init handler and initial arguments are the same as those given to B. Note that this function does not return until the server exits. Wraps any  process loopa and ensures that it adheres to the managed process start/stop semantics, i.e., evaluating the  InitHandler. with an initial state and delay will either die due to InitStop, exit silently (due to  InitIgnore) or evaluate the process' loop. The supplied loop must evaluate to  ExitNormal(, otherwise the calling processing will die with whatever  ExitReason is given. A default 2, with no api, info or exit handler. The default  simply continues, the  is a no-op and the  is  Terminate.Turns a standard  into a "%, by virtue of the supplied list of + expressions.Sets the default recvTimeoutPolicy!, which gives up after 10k reads.Creates a default " from a list of +. See  for the underlying definition.A basic, stateless . See  for the default field values.A default, state unaware c that can be used with . This simply returns InitOk2 with the empty state (i.e., unit) and the given . ! "#$%&'()*+0LU[^abcdefghijklmnopqrvz  9:;<=>?@ABCDEFGHIJKLMNOPQ{|}~Ac"#$%&'()*0+barnzmvlkgjihfed !opq^[    !"#$%&'()*+,,-./01234567899:;<=>?@@ABBCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`aabccdefghijklmnopqrstuvvwxyyz{|}~w     q !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]     ! " # $ % & ' ( ^ _ ` a b c d e f gh i i j k l m > ; < nopqrstuvwxyz{yz|y}~ooEq%y}y =distributed-process-client-server-0.2.2-3LqubAkxesJ279p4ncdET0Control.Distributed.Process.ManagedProcess.Timer9Control.Distributed.Process.ManagedProcess.Internal.Types1Control.Distributed.Process.ManagedProcess.ServerControl.Distributed.Process.ManagedProcess.Internal.GenProcess5Control.Distributed.Process.ManagedProcess.Server.Gen:Control.Distributed.Process.ManagedProcess.Server.Priority1Control.Distributed.Process.ManagedProcess.Client*Control.Distributed.Process.ManagedProcessAControl.Distributed.Process.ManagedProcess.Internal.PriorityQueueTimer timerDelayTimedOutYieldTimerKeyisActive delayTimer startTimer stopTimer resetTimer clearTimer matchTimeoutmatchKeymatchRun readTimer$fBinaryTimedOut $fEqTimedOut$fShowTimedOut$fGenericTimedOutProcessDefinition apiHandlers infoHandlersexternHandlers exitHandlerstimeoutHandlershutdownHandlerunhandledMessagePolicyUnhandledMessagePolicy Terminate DeadLetterLogDropPrioritisedProcessDefinition processDef prioritiesfilters recvTimeoutRecvTimeoutPolicyRecvMaxBacklog RecvTimerDispatchPriorityPrioritiseCallPrioritiseCastPrioritiseInfo prioritisePrioritygetPrio ExternMatcher matchExternmatchMapExternMessageMatcher matchDispatchExitSignalDispatcher dispatchExitDeferredDispatcher dispatchInfoExternDispatcher DispatchCC DispatchSTMchannel dispatchChan stmAction dispatchStmmatchStm matchAnyStm DispatcherDispatch DispatchIfdispatch dispatchIfDispatchFilter FilterApi FilterAny FilterRaw FilterState apiFilter anyFilter rawFilter stateFilterFilterFilterOk FilterSafe FilterReject FilterSkip FilterStop ControlPortunPortControlChannel unControlTimeoutHandlerShutdownHandler InitHandlerStatelessChannelHandlerChannelHandler InfoHandler CastHandlerStatelessCallHandlerDeferredCallHandlerStatelessHandler CallHandler ActionHandlerReplyAction ExitState CleanShutdown LastKnown ConditionStateInput ProcessReply ProcessRejectNoReply ProcessAction ProcessSkipProcessActivityProcessExpressionProcessContinueProcessTimeoutProcessHibernate ProcessStopProcessStopping ProcessBecome GenProcess ProcessState timeoutSpecprocDefprocPrio procFilters usrTimeout sysTimeout usrTimers internalQ procStateQueueLimit InitResultInitOkInitStop InitIgnore CallRejected CallResponseMessage CastMessage CallMessage ChanMessageCallRefunCallerCallId recipienttagmakeRefcallerrejectToCaller runProcessliftliftIOisCleanShutdown exitStatenewControlChanchannelControlPortinitCallunsafeInitCall waitResponse$fExternMatcherExternDispatcher $fMessageMatcherExternDispatcher$fMessageMatcherDispatcher$fEqControlPort$fMonadMaskGenProcess$fMonadCatchGenProcess$fMonadThrowGenProcess$fRoutableCallRef$fResolvableCallRef$fNFDataCallRejected$fBinaryCallRejected$fNFDataCallResponse$fBinaryCallResponse$fNFDataMessage$fBinaryMessage$fNFDataCallRef$fBinaryCallRef $fEqCallRef $fShowCallRef$fGenericCallRef$fGenericMessage$fGenericCallResponse$fGenericCallRejected$fShowCallRejected$fEqCallRejected$fShowControlPort$fShowUnhandledMessagePolicy$fEqUnhandledMessagePolicy$fFunctorGenProcess$fMonadGenProcess$fMonadStateGenProcess$fMonadIOGenProcess$fMonadFixGenProcess$fApplicativeGenProcess$fBinaryControlPort$fShowCallResponse$fEqCallResponse $fShowMessage $fEqMessage conditionstateinputreject rejectWithreply replyWithnoReplynoReply_ haltNoReply_continue continue_ timeoutAfter timeoutAfter_ hibernate hibernate_becomestopstopWithstop_replyTo replyChan handleCall_ handleCallIf_ handleCall handleCallIfhandleCallFrom_handleCallFromIf_handleCallFromhandleCallFromIf handleRpcChanhandleRpcChanIfhandleRpcChan_handleRpcChanIf_ handleCast handleCastIfhandleExternalhandleExternal_handleCallExternalhandleControlChanhandleControlChan_ handleCast_ handleCastIf_actionhandleDispatchhandleDispatchIf handleInfo handleRaw handleExit handleExitIfRestrictedActionRestrictedContinueRestrictedTimeoutRestrictedHibernateRestrictedStopResultTimeout HibernateStopRestrictedProcesssaygetStateputState modifyState haltNoReply handleTimeout$fFunctorRestrictedProcess$fMonadRestrictedProcess$fMonadStateRestrictedProcess$fMonadIORestrictedProcess$fApplicativeRestrictedProcesssendControlMessageshutdowncallsafeCalltryCall callTimeoutflushPendingCalls callAsynccastcallChan syncCallChansyncSafeCallChangetsgetAndModifyStatesetProcessStatesetUserTimeout addUserTimerremoveUserTimerprocessDefinitionprocessFilters processStateprocessUnhandledMsgPolicy processQueue systemTimeout drainTimeoutcurrentTimeout evalAfteractevalrunAfterdequeuepeekpushenqueue precvLooprecvLoop $fDynFilterHandlerDispatchFilter%$fDynMessageHandlerDeferredDispatcher#$fDynMessageHandlerExternDispatcher$fDynMessageHandlerDispatchercheckrawraw_apiapi_infoinfo_apiSafesafesafelycrash rejectApistorestoreMrefuseensureensureM setPriorityprioritiseCall_prioritiseCallprioritiseCast_prioritiseCastprioritiseInfo_prioritiseInfo$fShowRejectedByServercallSTMservepserve chanServedefaultProcess prioritiseddefaultProcessWithPrioritiesstatelessProcess statelessInitmtPidRefmtSignal PriorityQqemptyisEmpty singletontoList0distributed-process-0.6.6-A1O8CNuNLNUK4TyQ8hDZSE*Control.Distributed.Process.Internal.SpawnbaseGHC.BaseNothingTimerMap unManagedghc-prim GHC.TypesBool7distributed-process-extras-0.3.1-1QIH8DkCr7e7yoLSbE52CU'Control.Distributed.Process.Extras.TimeDelay TimeInterval1Control.Distributed.Process.Extras.Internal.Types ExitReason*Control.Distributed.Process.Internal.TypesSendPortProcessmkReplycheckRpc checkCall checkCastdecode Data.Typeable unRestricted wrapHandlerwrapCall runRestrictedDynFilterHandlerDynMessageHandlersetDrainTimeout consumeTimerprocessPriorities timeoutPolicy updateQueueenqueueMessagedynHandleFilterdynHandleMessageSafe recvQueueshutdownHandler'trapExitblock applyPolicy FilterHandler HandlePure HandleApi HandleRaw HandleSafeRejectedByServer HandleState pureCheckhandlerapiCheck apiHandlerrawCheck rawHandler stateHandler safeCheck filterFailShutdown3Control.Distributed.Process.Extras.UnsafePrimitivessenddefaultRecvTimeoutPolicy