@-      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ None%&'+,-03456;<=FKNQSTVhLF(Each process is identified by a single process id, that stays constant throughout the life cycle of a process. Also, message sending relies on these values to address messages to processes.Every function for  a things needs such a proxy value for the low-level effect list, i.e. the effects identified by r in   r : r;, this might be dependent on the scheduler implementation.0Tell the typechecker what effects we have below  Like  but shorterCons   onto a list of effects.Every   action returns it's actual result wrapped in this type. It will allow to signal errors as well as pass on normal results such as incoming messages. The process is required to exit. XThe process is required to exit from an error condition, that cannot be recovered from. :The process may resume to do work, using the given result. BThis indicates that the action did not complete, and maybe retried The process effect is the basis for message passing concurrency. This effect describes an interface for concurrent, communicating isolated processes identified uniquely by a process-id.Processes can raise exceptions that can be caught, exit gracefully or with an error, or be killed by other processes, with the option of ignoring the shutdown request.vProcess Scheduling is implemented in different modules. All scheduler implementations should follow some basic rules:fair scheduling sending a message does not blockreceiving a message does block*spawning a child blocks only a very momentJa newly spawned process shall be scheduled before the parent process after the spawnGwhen the first process exists, all process should be killed immediately In cooperative schedulers, this will give processing time to the scheduler. Every other operation implicitly serves the same purpose.Return the current jStart a new process, the new process will execute an effect, the function will return immediately with a .aProcess exit, this is the same as if the function that was applied to a spawn function returned.8Exit the process due to an error, this cannot be caught.$Raise an error, that can be handled.VRequest that another a process exits. The targeted process is interrupted and gets a A, the target process may decide to ignore the shutdown requests.-Send a message to a process addressed by the . Sending a message should **always succeed** and return **immediately**, even if the destination process does not exist, or does not accept messages of the given type.Receive a message. This should block until an a message was received. The pure function may convert the incoming message into something, and the result is returned as ProcessMessage value. Another reason why this function returns, is if a process control message was sent to the process. This can only occur from inside the runtime system, aka the effect handler implementation. (Currently there is one in  .) Execute a  d action and resume the process, retry the action or exit the process when a shutdown was requested.gExecute a and action and resume the process, retry the action, shutdown the process or return an error. Return a  for a   effect.Use  to execute   . Refer to   for more information.-Send a message to a process addressed by the . See .-Send a message to a process addressed by the . See  . Return True1 if the process existed. I you don't care, just  instead.-Send a message to a process addressed by the . See . Exit a process addressed by the . See .Like , but also return True iff the process to exit exists.jStart a new process, the new process will execute an effect, the function will return immediately with a .Like  but return (). #Block until a message was received.!%Receive and cast the message to some  instance."ZEnter a loop to receive messages and pass them to a callback, until the function returns .# Returns the  of the current process.$Exit the process.%Exit the process with an error.&"Thrown an error, can be caught by '.'$Catch and handle an error raised by &3. Works independent of the handler implementation.(Like ' it catches &R, but instead of invoking a user provided handler, the result is wrapped into an .*   !"#$%&'(8*8   !"#%$&'( None%&'+,-03456<FKNQSTVhb9'This is a tag-type that wraps around a  and holds an ? index type.<yThe (promoted) constructors of this type specify (at the type level) the reply behavior of a specific constructor of an Api instance.=[Specify that handling a request is a blocking operation with a specific return type, e.g. -('Synchronous (Either RentalError RentalId))>,Non-blocking, asynchronous, request handling?}This data family defines an API, a communication interface description between at least two processes. The processes act as servers or  client(s), regarding a specific instance of this type.PThe first parameter is usually a user defined phantom type that identifies the ? instance.LThe second parameter specifies if a specific constructor of an (GADT-like) Api instance is =;, i.e. returns a result and blocks the caller or if it is >Example:  data BookShop deriving Typeable data instance Api BookShop r where RentBook :: BookId -> Api BookShop ('Synchronous (Either RentalError RentalId)) BringBack :: RentalId -> Api BookShop 'Asynchronous type BookId = Int type RentalId = Int type RentalError = String ETag a  with an ? type index to mark it a 9 process handling that APIFTag a  with an ? type index to mark it a 9 process handling that API 9:;<=>?DEF ?<=>9:;DEF9:;<=> None%&'+,-03456<FKNQSTVhd\None%&'+,-03456<FKNQSTVhyGInstead of passing around a 9& value and passing to functions like I or J, a 9 can provided by a  effect, if there is only a  single server for a given ?I instance. This type alias is convenience to express that an effect has   and a reader for a 9.HSend an ?v request that has no return value and return as fast as possible. The type signature enforces that the corresponding ? clause is > . Return True if the message was sent to the process. Note that this is totally not the same as that the request was successfully handled. If that is important, use J instead.ISend an ?v request that has no return value and return as fast as possible. The type signature enforces that the corresponding ? clause is >.JSend an ?: request and wait for the server to return a result value.3The type signature enforces that the corresponding ? clause is =.K"Run a reader effect that contains the one server handling a specific ? instance.LLike J but take the 9 from the reader provided by K.MLike LG but also catch errors raised if e.g. the server crashed. By allowing  instances to contain the reply, application level errors can be combined with errors rising from inter process communication.NLike I but take the 9 from the reader provided by K.GHIJKLMNIHJNLMGKNone%&'+,-03456<FKNQSTVhmO+This module provides support for executing   actions from .?One use case is interacting with processes from the REPL, e.g.:Kimport Control.Eff.Concurrent.Process.SingleThreadedScheduler (defaultMain)import Data.Dynamicimport Data.Maybe`s <- forkInteractiveScheduler Control.Eff.Concurrent.Process.SingleThreadedScheduler.defaultMainhfooPid <- submit s (spawn (forever (receiveMessage SP >>= (logMsg . fromMaybe "Huh!??" . fromDynamic))))fooPid<0.1.0>)submit s (sendMessageAs SP fooPid "test")test!submit s (sendShutdown SP fooPid)]Contains the communication channels to interact with a scheduler running in its' own thread.P>Fork a scheduler with a process that communicates with it via $, which is also the reason for the Lift IO constraint.Q@Exit the schedulder immediately using an asynchronous exception.RSend a  V effect to the main process of a scheduler, this blocks until the effect is executed.SCombination of R and I.TCombination of R and I.OPQRSTOPQRSTONone%&'+,-03456<FKNQSTVh,UCatch  thrown by an effect.UU None%&'+,-03456<FKNQSTVhEmbeds a less-constrained 2 into a more-constrained one. Analogous to MTL's lift.None%&'+,-03456<FKNQSTVh`VTAn exception that is used by the mechanism that chains together multiple different W2 allowing a single process to implement multiple ?s. This exception is thrown by e%. This exception can be caught with c, this way, several distinct W can be tried until one fits or until the f is invoked.W3A record of callbacks, handling requests sent to a server  , all belonging to a specific ? family instance.YJA cast will not return a result directly. This is used for async methods.ZgA call is a blocking operation, the caller is blocked until this handler calls the reply continuation.[This callback is called with Nothing& if the process exits peacefully, or Just "error message..." if the process exits with an error. This function is responsible to exit the process if necessary. The default behavior is defined in _.\HReceive and process incoming requests until the process exits, using an W.Apply either the Z, Y or the [ callback to an incoming 7. Note, it is unlikely that this function must be used.]A default handler to use in Z in W. It will call & with a nice error message.^A default handler to use in Y in W. It will call & with a nice error message._9Exit the process either normally of the error message is Nothing or with % otherwise.`\ two W?s at once. The first handler is used for termination handling.a\ three W?s at once. The first handler is used for termination handling.b/The basic building block of the combination of W5s is this function, which can not only be passed to ", but also throws an V exception if eG failed, such that multiple invokation of this function for different Ws can be tried, by using c. ~tryApiHandler px handlers1 message `catchUnhandled` tryApiHandler px handlers2 `catchUnhandled` tryApiHandler px handlers3cIf e! failes to cast the message to a  for a certain W it throws an V exception. That exception is caught by this function and the raw message is given to the handler function. This is the basis for chaining Ws.dCatch V8s and terminate the process with an error, if necessary.eCast a $ value, and if that fails, throw an V error.f0If an incoming message could not be casted to a  corresponding to an W (e.g. with eO) one should use this function to exit the process with a corresponding error.VWXYZ[\]^_`abcdef\WXYZ[]^_`abVcdefVWXYZ[None%&'+,-03456;<=>?FKNQSTVhc1Internal exception to **immediately** shutdown a g process created by s , other than u the message queue will not be flushed, not further messages will be logged, except for the optional final message.!Internal exception to shutdown a g process created by s. This exception is handled such that all message already en-queued are handled and then an optional final message is written.g&A log channel processes logs from the hy effect by en-queuing them in a shared queue read from a seperate processes. A channel can contain log message filters.filter log messagesdiscard all log messages&send all log messages to a log processh9Logging effect type, parameterized by a log message type.jLog a message.k#Change, add or remove log messages. Requirements:[All log meta data for typical prod code can be added without changing much of the code5Add timestamp to a log messages of a sub-computation.Write some messages to a file.<Log something extra, e.g. runtime memory usage in load testsApproach: Install a callback that sneaks into to log message sending/receiving, to intercept the messages and execute some code and then return a new message.lFChange, add or remove log messages without side effects, faster than k. Requirements:5Tests run fast in unit tests so travis won't time outDrop debug logs Grep like log filteringApproach: Install a callback that sneaks into to log message sending/receiving, to intercept the messages and execute some code and then return a new message.mCapture the logs in a .nThrow away all log messages.oHandle h effects using  s.pSend the log messages to a g.q(Enqueue a log message into a log channelr Create a g* that will discard all messages sent via forwardLogstochannel or q.sPFork a new process, that applies a monadic action to all log messages sent via p or q.tFilter logs sent to a g using a predicate.uRun an action and close a g created by r, s or t afterwards using v. If a - was thrown, the log channel is killed with w!, and the exception is re-thrown.v$Close a log channel created by e.g. s. Message already enqueue are handled, as well as an optional final message. Subsequent log message will not be handled anymore. If the log channel must be closed immediately, use w instead.wClose a log channel quickly, without logging messages already in the queue. Subsequent logging requests will not be handled anymore. If the log channel must be closed without loosing any messages, use v instead.xWrap g4 creation and destruction around a monad action in y manner. This function uses vM, so en-queued messages are flushed on exit. The resulting action in in the D monad, which is essentially a reader for the log handler function.sYSize of the log message input queue. If the queue is full, message are dropped silently. An IO action to log the messages Optional first message to logxYSize of the log message input queue. If the queue is full, message are dropped silently. Optional first message to log Optional last message to log An IO action that will use the gY, after the action returns (even because of an exception) the log channel is destroyed.M     ghijklmnopqrstuvwxhijklmnogprstvwuxqghiNone%&'+,-03456<FKNQSTVhm}The concrete list of (ects for running this pure scheduler on IO and with string logging.~Invoke  with lift ! as yield effect. @since 0.3.0.2Like  but pure. The yield effect is just  return (). schedulePure ==  .  (return ()) @since 0.3.0.2Like  but with logging. scheduleWithLogging ==  . m .  (return ()) @since 0.3.0.2 Execute a   and all the other processes xed by it in the current thread concurrently, using a co-routine based, round-robin scheduler. If a process exits with $, %, &! or is killed by another process Left ...: is returned. Otherwise, the result will be wrapped in a Right.A  for }. Execute a   using  on top of  IO and h String effects.An that performs a yield w.r.t. the underlying effect r . E.g. if Lift IO$ is present, this might be: @lift .}~~}  !"#$%&' None%&'+,-03456;<=>?FKNQSTVhZ(1Information about a process, needed to implement MessagePassing and  , handlers. The message queue is backed by a ) and contains  MessageQEntry values.* Contains all (e elements, as well as the state needed to implement inter process communication. It contains also a g6 to which the logs of all processes are forwarded to.The concrete list of ;ects for this scheduler implementation. See HasSchedulerIOsAn alias for the constraints for the effects essential to this scheduler implementation, i.e. these effects allow ing new  es. See SchedulerIO@A sum-type with errors that can occur when scheduleing messages.No ( was found for a j during internal processing. NOTE: This is **ONLY** caused by internal errors, probably by an incorrect MessagePassingq handler in this module. **Sending a message to a process ALWAYS succeeds!** Even if the process does not exist.A process called &.A process called %.A process exits.<An action was not performed while the scheduler was exiting.+A newtype wrapper around an , holding a * state. This is needed by  and provided by  runScheduler.A  for jThis is the main entry point to running a message passing concurrency application. This function takes a   on top of the  effect and a g for concurrent logging.<Start the message passing concurrency system then execute a   on top of 0 effect. All logging is sent to standard output.<Start the message passing concurrency system then execute a   on top of 0 effect. All logging is sent to standard output. (-./0*123456789:;+<=None%&'+,-03456;<=FKNQSTVhH ?>?@ABCDEFGHBCIA@>? None%&'+,-03456;<=>?FKNQSTVh)oAn : that schedules the observations to an effectful callback.Internal state for manageobservers An existential wrapper around a 9 of an G. Needed to support different types of observers to observe the same  in a general fashion.An ?: index that supports registration and de-registration of s./Type of observations visible on this observable Return the ? value for the cast_ that registeres an observer Return the ? value for the cast_ that de-registeres an observerAn ?0 index that support observation of the another ? that is . Wrap the  and the  (i.e. the 9&) that caused the observation into a ? value that the  understands.Send an  to an  Send the  Send the Send an  to .Keep track of registered .s Observers can be added and removed, and an 0 can be sent to all registerd observers at once.Add an  to the  managed by . Delete an  from the  managed by .Send an  to all  s in the  state.Start a new process for an ; that schedules all observations to an effectful callback.Use 4 to create a universal logging observer, using the J instance of the  . | Start a new process for an ; that schedules all observations to an effectful callback.KLMNNone%&'+,-03456;<=>?FKNQSTVh+p?OPQRSTUVWXYZ[\]^_U`TSRQaOPNone%&'+,-03456<FKNQSTVh,bcdefghij !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHHIJKLMNOPQRSTUVWXYZ[\]^_`abcdeefghijklmnopqrstuvwxyz{|}~                      ] d       !"#$$%&'()*+,-./00123456789 :;<= > ?+@ : A B C > D E F G H I I J J K ? LMNOPPQRSTUVWX  Y Z [\]^_`abcdRefghijklmnopqrstuv;extensible-effects-concurrent-0.3.0.2-bMnFlms3mGDUS2GASZ5VMControl.Eff.Concurrent.ProcessControl.Eff.Concurrent.Api!Control.Eff.Concurrent.Api.Client*Control.Eff.Concurrent.Process.InteractiveControl.Eff.ExceptionExtra!Control.Eff.Concurrent.Api.ServerControl.Eff.Log6Control.Eff.Concurrent.Process.SingleThreadedScheduler.Control.Eff.Concurrent.Process.ForkIOScheduler#Control.Eff.Concurrent.Api.ObserverForkIOScheduler#Control.Eff.Concurrent.Api.InternalControl.Eff.InternalExtraControl.Eff.Concurrent.Examples Control.Eff.Concurrent.Examples2#Paths_extensible_effects_concurrent ProcessId_fromProcessIdSchedulerProxySP ConsProcess ResumeProcessShutdownRequestedOnError ResumeWithRetryLastActionProcess YieldProcessSelfPidSpawnShutdown ExitWithError RaiseError SendShutdown SendMessageReceiveMessageexecuteAndCatchthisSchedulerProxy yieldProcess sendMessagesendMessageChecked sendMessageAs sendShutdownsendShutdownCheckedspawnspawn_receiveMessagereceiveMessageAs receiveLoopself exitNormally exitWithError raiseErrorcatchRaisedErrorignoreProcessError$fShowProcessId$fReadProcessId$fFoldableResumeProcess$fFunctorResumeProcess$fShowResumeProcess$fEqResumeProcess$fOrdResumeProcess$fTraversableResumeProcess $fEqProcessId$fOrdProcessId$fBoundedProcessId$fNumProcessId$fEnumProcessId$fIntegralProcessId$fRealProcessId fromProcessIdServer _fromServer Synchronicity Synchronous AsynchronousApi $fShowServer $fReadServer $fEqServer $fOrdServer fromServer proxyAsServerasServer ServesApi castCheckedcastcallregisterServercallRegisteredcallRegisteredAcastRegisteredSchedulerSessionforkInteractiveSchedulerkillInteractiveSchedulersubmit submitCast submitCallliftTryUnhandledRequest ApiHandler _handleCast _handleCall_handleTerminateserveunhandledCallErrorunhandledCastErrordefaultTermination serveBothserve3 tryApiHandlercatchUnhandledensureAllHandledrequestFromDynamic exitUnhandled LogChannelLogsLogMsglogMsgfoldLog foldLogFast captureLogs ignoreLogshandleLogsWith logToChannellogChannelPutIOnoLogger forkLoggerfilterLogChannelcloseLogChannelAfterjoinLogChannelkillLogChannellogChannelBracket"$fExceptionJoinLogChannelException"$fExceptionKillLogChannelException$fShowJoinLogChannelException$fShowKillLogChannelException LoggingAndIo scheduleIO schedulePurescheduleWithLoggingschedulesingleThreadedIoScheduler defaultMain$fShowProcessInfo SchedulerIOHasSchedulerIOSchedulerErrorProcessNotFoundProcessRaisedErrorProcessExitErrorProcessShuttingDownSchedulerShuttingDownforkIoSchedulerdefaultMainWithLogChannel$fExceptionSchedulerError$fShowSchedulerErrorCallbackObserver Observers SomeObserver Observable ObservationregisterObserverMessageforgetObserverMessageObserverobservationMessagenotifyObserverregisterObserverforgetObservernotifySomeObservermanageObservers addObserverremoveObservernotifyObserversspawnCallbackObserverspawnLoggingObserver$fEqSomeObserver$fOrdSomeObserver$fObserverCallbackObservero $fShowApi$fShowSomeObserverexecuteAndResumebaseData.Typeable.InternalTypeableghc-prim GHC.TypesFalse Data.EitherEitherResponseRequestCallCast Terminate1extensible-effects-2.4.0.0-JphDeH2tFKrBwXHcuoH25jControl.Eff.Reader.LazyReaderGHC.Base AlternativeIOGHC.MVarMVarSchedulerQueue GHC.Exception ExceptionControl.Eff.Exception ignoreFail liftMaybeM liftMaybe liftEitherM liftEither rethrowErroronFail catchErrorrunFailrunErrordie throwErrorExcFailraise Control.EffEffapplyApiHandler Data.DynamicDynamicfromUnhandledRequestKillLogChannelExceptionJoinLogChannelExceptionFilteredLogChannel DiscardLogsConcurrentLogChannelcontainers-0.5.10.2Data.Sequence.InternalSeq*logging-effect-1.3.1-HVYcAy8z1JKn4QN0e8dOMControl.Monad.LogLoggingTHandler SomeExceptionControl.Exception.BasebracketrunPureLoggingT withFDHandlerwithBatchedHandlerdefaultBatchingOptions mapLoggingT runLoggingT withCallStackrenderWithCallStack timestamprenderWithTimestamp logEmergencylogAlert logCriticallogError logWarning logNoticelogInfologDebugrenderWithSeveritymapLogMessageM mapLogMessage logMessageMonadLoglogMessageFree WithSeverity msgSeveritydiscardSeveritySeverityError EmergencyAlertCriticalWarningNotice InformationalDebug WithTimestampdiscardTimestamp msgTimestamp WithCallStack msgCallStackdiscardCallStackBatchingOptions flushMaxDelayflushMaxQueueSize blockWhenFull PureLoggingTMkPureLoggingTDiscardLoggingTdiscardLogging*prettyprinter-1.2.1-1zha0w8F0sW2Cmd9Q3a4bf"Data.Text.Prettyprint.Doc.Internal layoutPrettyfromLogChannel_logChannelThread GHC.Conc.SyncyieldrunControl.Eff.LiftLiftOnYieldOnSelfOnSpawnOnDone OnShutdown OnExitError OnRaiseErrorOnSendOnRecvOnSendShutdown ProcessInfo"stm-2.4.5.0-CXcLaVXVJJw3aE4nNNb3zuControl.Concurrent.STM.TQueueTQueue Scheduler SchedulerVarTVar _processId _messageQ_shutdownRequested_nextPid _processTable_threadIdTable_schedulerShuttingDown _logChannelShutdownAction CleanUpActionrunCleanUpActionfromSchedulerVarTerminateErrorShoutSayHello MyExceptionTestApimain!mainProcessSpawnsAChildAndReturnsexampletestServerLoopD:R:ApiTestApix0GHC.ShowShow _observersD:R:ApiCallbackObserverr0 CbObservedAddAAddUnobserveCounterObserveCounterCntInc CountChanged PocketCalcCounterlogCounterObservationscounterHandlerpocketCalcHandler serverLoopcounterExample$fObservableCounterD:R:ObservationCounter0D:R:ApiCounterx0D:R:ApiPocketCalcx0version getBinDir getLibDir getDynLibDir getDataDir getLibexecDir getSysconfDirgetDataFileName