Cq*      !"#$%&'()*+,-./0123456789: ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~  A Maybe-like poison wrapper.   %DAn individual record of an event, found in nested traces. Either a I channel write or read, or a barrier synchronisation, each with a unique  identifier for the barrier/(channel. The event will be recorded by B everyone involved, and a ChannelWrite will have the same channel H identifier as the corresponding channel-read. The identifiers are per  channel/>barrier, not per event. Currently, channels and barriers can C never have the same Unique as each other, but do not rely on this  behaviour. BA globally recorded event, found in CSP and VCR traces. Either a F channel communication (with a unique identifier of the channel) or a I barrier synchronisation (with a unique identifier of the barrier). The  identifiers are per channel/$barrier, not per event. Currently, I channels and barriers can never have the same Unique as each other, but  do not rely on this behaviour. GRecords an event where you were the last person to engage in the event ;Records an event where you were one of the people involved %%  1A class indicating that something is poisonable. Poisons the given item. CA class representing a type of trace. The main useful function is  , J but because its type is only determined by its return type, you may wish L to use the already-typed functions offered in each trace module -- see the  modules in Control.Concurrent.CHP.Traces. HRuns the given CHP program, and returns its return value and the trace. G The return value is a Maybe type because the process may have exited H due to uncaught poison. In that case Nothing is return as the result. The empty trace. (Pretty-prints the given trace using the Text.PrettyPrint.HughesPJ  module. HA monad transformer class that is very similar to MonadIO. This can be K useful if you want to add monad transformers (such as StateT, ReaderT) on  top of the  monad. /The central monad of the library. You can use runCHP and runCHP_ $ to execute programs in this monad. FAn enrolled wrapper for barriers that shows at the type-level whether J you are enrolled on a barrier. Enrolled Barriers should never be passed N to two (or more) processes running in parallel; if two processes synchronise A based on a single enroll call, undefined behaviour will result. )An internal dummy type for poison errors NChecks for poison, and either returns the value, or throws a poison exception Throws a poison exception. IAllows you to provide a handler for sections with poison. It is usually # used in an infix form as follows:  F (readChannel c >>= writeChannel d) `onPoison` (poison c >> poison d) CIt handles the poison and does not rethrow it (unless your handler 5 does so). If you want to rethrow (and actually, you'll find you usually  do), use onPoisonRethrow Like 0, this function allows you to provide a handler E for poison. The difference with this function is that even if the E poison handler does not throw, the poison exception will always be G re-thrown after the handler anyway. That is, the following lines of % code all have identical behaviour:  foo # foo `onPoisonRethrow` throwPoison ! foo `onPoisonRethrow` return () 3Poisons all the given items. A handy shortcut for  mapM_ poison.    ,A trace type that does not record anything. NA classic CSP trace. It is simply the channel labels, and a list of recorded I events in sequence -- the head of the list is the first (oldest) event.  LA nested (or hierarchical) trace. The trace is an event hierarchy, wrapped K in a Maybe type to allow for representation of the empty trace (Nothing). UA data type representing a hierarchy of events. The count on the StructuralSequence @ count is a replicator count for that list of sequential items.  TFlattens the events into a list. The resulting list may contain duplicates, and it I should not be assumed that the order relates in any way to the original  hierarchy. !"  !" !"  !"#AA VCR (View-Centric Reasoning) trace. It is the channel labels, G accompanied by a sequential list of sets of recorded events. Each of F the sets is a set of independent events. The set at the head of the & list is the first-recorded (oldest). $%&#$%&#$%&#$$%&  !"#$%&   '9A monad transformer used for introducing forking blocks. (IThis type-class supports parallel composition of processes. You may use  the (- function to run a list of processes, or the ) operator " to run just a pair of processes. HIn each case, the composition waits for all processes to finish, either 6 successfully or with poison. At the end of this, if any process * exited with poison, the composition will rethrow this poison. If all I the processes completed successfully, the results will be returned. If G you want to ignore poison from the sub-processes, use an empty poison  handler and  with each branch. FRuns the given list of processes in parallel, and then returns a list M of the results, in the same order as the processes given. Will only return . when all the inner processes have completed. )IA useful operator for performing a two process equivalent of runParallel L that gives the return values back as a pair rather than a list. This also + allows the values to have different types *HRuns all the given processes in parallel and discards any output. Does _ not return until all the processes have completed. runParallel_ ps is effectively equivalent  to ( ps >> return (). GRuns all the processes in parallel and returns their results once they I have all finished. The length and ordering of the results reflects the " length and ordering of the input +IExecutes a forking block. Processes may be forked off inside (using the  ,C function). When the block completes, it waits for all the forked K off processes to complete before returning the output, as long as none of I the processes terminated with uncaught poison. If they did, the poison  is propagated (rethrown). ,JForks off the given process. The process then runs in parallel with this I code, until the end of the forking block, when all forked-off processes J are waited for. At that point, once all of the processes have finished, / if any of them threw poison it is propagated. '()*+,(*)'+,'()*+, -DA monad transformer for easier looping. This is independent of the H CHP aspects, but has all the right type-classes defined for it to make & it easy to use with the CHP library. .HRuns a CHP program. You should use this once, at the top-level of your J program. Do not ever use this function twice in parallel and attempt to Q communicate between those processes using channels. Instead, run this function D once and use it to spawn off the parallel processes that you need. /Runs a CHP program. Like . but discards the output. 0ARuns the given action in a loop, executing it repeatedly until a 1 8 statement inside it has a False condition. If you use 0 without 1,  the effect is the same as . 1GContinues executing the loop if the given value is True. If the value I is False, the loop is broken immediately, and control jumps back to the  next action after the outer 0/ statement. Thus you can build pre-condition,  post-condition, and  mid-condition' loops, placing the condition wherever  you like. 2IWaits for the specified number of microseconds (millionths of a second). L There is no guaranteed precision, but the wait will never complete in less  time than the parameter given. Suitable for use in an alt*, but note that waitFor 0 is not the same  as skip. 2 0 </>+ x will not always select the first guard, A depending on x. Included in this is the lack of guarantee that  2 0 </> 2- n will select the first guard for any value F of n (including 0). It is not useful to use two waitFor guards in a  single alt anyway. 3The classic skip process/+guard. Does nothing, and is always ready. Suitable for use in an alt. 4HThe stop guard. Its main use is that it is never ready in a choice, so M can be used to mask out guards. If you actually execute stop, that process K will do nothing more. Any parent process waiting for it to complete will  wait forever.  -./01234 ./-01342-./0123456HEnrolls on the given barrier, then executes the given function (passing K it in the enrolled barrier) and when that function body finishes, resigns Q from the barrier and returns the result. If a poison or IO exception is thrown G in the inside block, the barrier will be correctly resigned from, and  the exception rethrown. Do not attempt to return the C enrolled barrier out of the inner function and use it afterwards. 7EResigns from a barrier, then executes the given action, and when the J action finishes, re-enrolls on the barrier and continues. This function  is designed for use from inside the body of the 6 function, to H temporarily resign from a barrier, do some things, then re-enroll. Do I not use the enrolled barrier inside the resign block. However, you may H enroll on the barrier inside this, nesting enroll and resign blocks as  much as you like 8Like 6+ but enrolls on the given pair of barriers 9Like 6+ but enrolls on the given list of barriers 56789567895676789 :DAn alt between several actions, with arbitrary priority. The first I available action is chosen (with an arbitrary choice if many guards are D available at the same time), its body run, and its value returned. ;DAn alt between several actions, with arbitrary priority. The first J available action is chosen (biased towards actions nearest the beginning 6 of the list), its body run, and its value returned. < A useful operator to perform an :!. This operator is associative, R and has arbitrary priority. When you have lots of guards, it is probably easier  to use the : function. : may be more efficent than  foldl1 (<->) =A useful operator to perform a ;. This operator is : associative, and has descending priority (that is, it is E left-biased). When you have lots of actions, it is probably easier  to use the ; function. ; may be more efficent than  foldl1 (</>) :;<=:<;=:;<= >HA wrapper (usually around a channel-end) indicating that the inner item  is shared. Use the claim function to use this type. ?DA channel type, that can be used to get the ends of the channel via A  and B @Gets the channel'9s identifier. Useful if you need to be able to identify " a channel in the trace later on. A+Gets the reading end of a channel from its ? type. B+Gets the writing end of a channel from its ? type. CHA phased barrier that is capable of being poisoned and throwing poison. ? You will need to enroll on it to do anything useful with it. J For the phases you can use any type that satisfies Enum, Bounded and Eq. P The phase increments every time the barrier completes. Incrementing consists  of: *if p == maxBound then minBound else succ p. Examples of things that  make sense for phases:  The () type (see the 1 type). This effectively has a single repeating , phase, and acts like a non-phased barrier. V A bounded integer type. This increments the count every time the barrier completes.  But don'At forget that the count will wrap round when it reaches the end.  You cannot use 5 for a phase because it is unbounded. If you really ; want to have an infinitely increasing count, you can wrap  in a newtype and J provide a Bounded instance for it (with minBound and maxBound set to -1,  if you start on 0). K A boolean. This implements a simple black-white barrier, where the state  flips on each iteration. > A custom data type that has only constructors. For example, data MyPhases  = Discover | Plan | Move/. Haskell supports deriving Enum, Bounded and ! Eq automatically on such types. OSynchronises on the given barrier. You must be enrolled on a barrier in order N to synchronise on it. Returns the new phase, following the synchronisation. >?@ABC >?@AB@ABC DFA special case of the PhasedBarrier that has no useful phases, i.e. a  standard barrier. EOSynchronises on the given barrier. You must be enrolled on a barrier in order N to synchronise on it. Returns the new phase, following the synchronisation. F-Finds out the current phase a barrier is on. GFIf the barrier is not in the given phase, synchronises on the barrier  repeatedly until it is in the given phase H1Creates a new barrier with no processes enrolled IFCreates a new barrier with no processes enrolled, that will be on the K given phase. You will often want to pass in the last value in your phase C cycle, so that the first synchronisation moves it on to the first JICreates a new barrier with no processes enrolled and labels it in traces  using the given label KICreates a new barrier with no processes enrolled and labels it in traces  using the given label LHGets the identifier of a Barrier. Useful if you want to identify it in  the trace later on. CDEFGHIJKL DHJCIKFGEL DEFGHIJKL ,MFA helper class for easily creating several channels of the same type. F The same type refers not only to what type the channel carries, but E also to the type of channel (one-to-one no poison, one-to-any with / poison, etc). You can write code like this:   (a, b, c, d, e) <- newChannels *To create five channels of the same type. NO5A class indicating that a channel can be written to. P*Writes from the given writing channel-end QHStarts the communication, then performs the given extended action, then + sends the result of that down the channel R4A class indicating that a channel can be read from. S)Reads from the given reading channel-end THPerforms an extended read from the channel, performing the given action  before freeing the writer UFA class used for allocating new channels, and getting the reading and I writing ends. There is a bijective assocation between the channel, and O its pair of end types. You can see the types in the list of instances below. I Thus, newChannel may be used, and the compiler will infer which type of M channel is required based on what end-types you get from reader and writer. I Alternatively, if you explicitly type the return of newChannel, it will I be definite which ends you will use. If you do want to fix the type of K the channel you are using when you allocate it, consider using one of the  many e--like shorthand functions that fix the type. V2Allocates a new channel. Nothing need be done to  destroy/5de-allocate the channel when it is no longer in use. WXYZ[;A writing channel-end type that allows poison to be thrown \;A reading channel-end type that allows poison to be thrown ]Like V4 but also associates a label with that channel in a H trace. You can use this function whether tracing is turned on or not, = so if you ever use tracing, you should use this rather than V. ^A helper that is like V% but returns the reading and writing  end of the channels directly. _A helper that is like V% but returns the writing and reading  end of the channels directly. `GCreates a list of channels of the same type with the given length. If J you need to access some channels by index, use this function. Otherwise  you may find using N to be easier. aA helper that is like `$, but labels the channels according L to a pattern. Given a stem such as foo, it names the channels in the list  foo0, foo1, foo2, etc. bA helper that is like `#, but labels the channels with the K given list. The number of channels returned is the same as the length of  the list of labels cBGets all the reading ends of a list of channels. A shorthand for map  reader. dBGets all the writing ends of a list of channels. A shorthand for map  writer. efFClaims the given channel-end, executes the given block, then releases C the channel-end and returns the output value. If poison or an IO G exception is thrown inside the block, the channel is released and the  poison/exception re-thrown. ghi">?@ABMNOPQRSTUVWXYZ[\]^_`abcdefghi%?@ABUV]_^MN`ba@\[ABcdRSTOPQf>ZeXhYgWiMNNOPQPQRSTSTUVVWXYZ[\]^_`abcdefghi jkl(The writing end of a broadcast channel. mFThe reading end of a broadcast channel. You must enroll on it before $ you can read from it or poison it.      nojklmnomlkjnojklmnoS '()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmno pLForever forwards the value onwards, unchanged. Adding this to your process 1 network effectively adds a single-place buffer. qHForever forwards the value onwards, in an extended rendezvous. This is  like p1 but does not add any buffering to your network. ,extId is a unit of the associative operator |->|. r8A process that waits for an input, then sends it out on all its output T channels (in order) during an extended rendezvous. This is often used to send the L output on to both the normal recipient (without introducing buffering) and N also to a listener process that wants to examine the value. If the listener L process is first in the list, and does not take the input immediately, the I value will not be sent to the other recipients until it does. The name J of the process derives from the notion of a wire-tap, since the listener N is hidden from the other processes (it does not visibly change the semantics  for them). sBSends out a single value first (the prefix) then behaves like id. tBForever reads in a value, and then sends out its successor (using ). uGReads in a value, and sends it out in parallel on all the given output  channels. vOForever reads in a value, transforms it using the given function, and sends it I out again. Note that the transformation is not applied strictly, so don't A assume that this process will actually perform the computation. wHForever reads in a value, and then based on applying the given function G either discards it (if the function returns false) or sends it on (if  the function returns True). xGStreams all items in a Traversable container out in the order given by  7 on the output channel (one at a time). Lists, Maybe, J and Set are all instances of Traversable, so this can be used for all of  those. yCForever waits for input from one of its many channels and sends it " out again on the output channel. zHSends out the specified value on the given channel the specified number  of times, then finishes. {GForever sends out the same value on the given channel, until poisoned. @ Similar to the white-hole processes in some other frameworks. |IForever reads values from the channel and discards them, until poisoned. @ Similar to the black-hole processes in some other frameworks. }KForever reads a value from both its input channels in parallel, then joins Q the two values using the given function and sends them out again. For example,   join (,) c d will pair the values read from c and d and send out the % pair on the output channel, whereas join (&&) will send out the conjunction  of two boolean values,  join (==)) will read two values and output whether  they are equal or not, etc. ~.A sorter process. When it receives its first Just x data item, it keeps L it. When it receieves a second, it keeps the lowest of the two, and sends L out the other one. When it receives Nothing, it sends out its data value, Q then sends Nothing too. The overall effect when chaining these things together I is a sorting pump. You inject all the values with Just, then send in a ; single Nothing to get the results out (in reverse order). FLike sorter, but with a custom comparison method. You should pass in  the equivalent of less-than: (<). pqrstuvwxyz{|}~pqrstuvwxyz{|}~pqrstuvwxyz{|}~HActs like a limited capacity FIFO buffer of the given size. When it is E full it accepts no input, and when it is empty it offers no output. IActs like a FIFO buffer with unlimited capacity. Use with caution; make O sure you do not let the buffer grow so large that it eats up all your memory. C When it is empty, it offers no output. It always accepts input. JActs like a FIFO buffer of limited capacity, except that when it is full, W it always accepts input and discards it. When it is empty, it does not offer output. JActs like a FIFO buffer of limited capacity, except that when it is full, M it always accepts input and pushes out the oldest item in the buffer. When ( it is empty, it does not offer output. IA set of channels to be given to the process to run, containing channels  for stdin, stdout and stderr. JA function for running the given CHP process that wants console channels. N When your program finishes, the console channels are automatically poisoned,  but it'Ds good practice to poison them yourself when you finish. Only ever K run one of these processes at a time, or undefined behaviour will result. FNote: getting the input handler to terminate is surpisingly difficult H in Haskell. Currently it seems (version 6.8.2) that GHC compiling the D end program with -threaded requires an extra character to be input D before the input handler notices poison, whereas GHC compiled (not H using -threaded) and GHCi act as intended. This is not a problem with I the whole of the library, only with this consoleProcess. Unfortunately C this means the one or two poison examples in the tutorial may not A function correctly. I hope to resolve this problem in the next  version. IWires given processes up in a forward cycle. That is, the first process K writes to the second, and receives from the last. It returns the list of N wired-up processes, which you will almost certainly want to run in parallel. GWires the given processes up in a forward pipeline. The first process Q in the list is connected to the given reading channel-end (the first parameter) J and the writing end of a new channel, A. The second process is wired up J to the reading end of A, and the writing end of the next new channel, B. L This proceeds all the way to the end of the list, until the final process I is wired to the reading end of Z (if you have 27 processes in the list, L and therefore 26 channels in the middle of them) and the second parameter. R The list of wired-up processes is returned, which you can then run in parallel. JProcess composition. Given two processes, composes them into a pipeline, J like function composition (but with an opposite ordering). The function A is associative. Using wirePipeline will be more efficient than foldl1  (|->|) for more than two processes. ,The reversed version of the other operator.  !"#$%&'()*+,-./001233456789:;;<=>?@ABCDEFGHIJKLMNOP Q R S TUVWXYZ [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~      #*/ UV[            r s              !"# chp-1.0.0Control.Concurrent.CHP.TracesControl.Concurrent.CHP.MonadControl.Concurrent.CHP.Enroll&Control.Concurrent.CHP.Traces.TraceOff!Control.Concurrent.CHP.Traces.CSP(Control.Concurrent.CHP.Traces.Structural!Control.Concurrent.CHP.Traces.VCRControl.Concurrent.CHP.ParallelControl.Concurrent.CHP.AltControl.Concurrent.CHP.ChannelsControl.Concurrent.CHP.Barriers(Control.Concurrent.CHP.BroadcastChannelsControl.Concurrent.CHP.CommonControl.Concurrent.CHP.BuffersControl.Concurrent.CHP.ConsoleControl.Concurrent.CHP.Utils Control.Concurrent.CHP.ProcessIdControl.Concurrent.CHP.PoisonControl.Concurrent.CHP.MutexControl.Concurrent.CHP.Event"Control.Concurrent.CHP.Traces.BaseControl.Concurrent.CHP.GuardControl.Concurrent.CHP.BaseControl.Concurrent.CHP.CSPControl.Concurrent.CHPRecordedIndivEventBarrierSyncIndiv ChannelRead ChannelWrite RecordedEvent BarrierSync ChannelComm PoisonablepoisonTracerunCHPAndTrace emptyTrace prettyPrintMonadCHPliftCHPCHPEnrolled throwPoison onPoisonTraponPoisonRethrow poisonAllTraceOffCSPTracerunCHP_CSPTracerunCHP_CSPTraceAndPrintStructuralTraceEventHierarchyStructuralParallelStructuralSequence SingleEventgetAllEventsInHierarchyrunCHP_StructuralTracerunCHP_StructuralTraceAndPrintVCRTracerunCHP_VCRTracerunCHP_VCRTraceAndPrintForkingT runParallel<||> runParallel_forkingfork LoopWhileTrunCHPrunCHP_loopwhilewaitForskipstop Enrollableenrollresign enrollPair enrollListaltpriAlt<->SharedChangetChannelIdentifierreaderwriter PhasedBarrierBarrier syncBarrier currentPhase waitForPhase newBarriernewPhasedBarriernewBarrierWithLabelnewPhasedBarrierWithLabelgetBarrierIdentifier ChannelTuple newChannelsWriteableChannel writeChannelextWriteChannelReadableChannel readChannelextReadChannelChannel newChannelAnyToAnyChannelOneToAnyChannelAnyToOneChannelOneToOneChannelChanoutChaninnewChannelWithLabel newChannelRW newChannelWRnewChannelListnewChannelListWithStemnewChannelListWithLabelsreaderswritersoneToOneChannelclaimanyToOneChanneloneToAnyChannelanyToAnyChannelAnyToManyChannelOneToManyChannelBroadcastChanoutBroadcastChaninoneToManyChannelanyToManyChannelidextIdtapprefixsuccparDeltamapfilterstreammerger replicaterepeatconsumejoinsortersorter' fifoBufferinfiniteBufferoverflowingBufferoverwritingBuffer ConsoleChanscStdincStdoutcStderrconsoleProcess wireCycle wirePipeline|->||<-| ProcessId ProcessIdPartParSeq rootProcessIdemptyProcessIdpidLessThanOrEqual WithPoisonNoPoison PoisonItemMutex claimMutexnewMutex releaseMutexOfferSetEventnewEvent enrollEvent resignEvent retractOffers completeEvent enableEvents disableEvents poisonEvent StructuredRevSeqParStrEvent SubTraceStore VCRTraceRev CSPTraceRev Hierarchy ChannelLabels TraceStoreNoTraceTraceT RecEventsgetName nameEventnameIndivEventensureAllNamedensureAllNamedIndivrecordEventLast recordEventmergeSubProcessTracesshouldMakeNewSetVCRcompress addParEventsH addSeqEventHaddRLE labelEvent labelUnique blankTracesGuard NestedGuards EventGuardBadGuard StopGuard SkipGuard TimeoutGuard skipGuardbadGuard stopGuard guardWaitForCHP'AltableT getAltable getStandardPoisonT PoisonError liftTrace wrapPoison unwrapPoison checkPoison liftPoisonliftSTM getProcessIdrunCHPProgramWithrunCHPProgramWith'toPublicnameCSPnameVCRForking wrapProcessrunParallelPoisonLWTgetLoopbase Control.MonadforeverpriAlt' integer-gmpGHC.Integer.TypeIntegerrecAsbuildOnEventPoison scopeBlocksyncBarrierWith repeatUntilChanoutCstartWriteChannelCendWriteChannelC poisonWriteCChaninCstartReadChannelCendReadChannelC poisonReadC STMChannelSTMChanchanwaitForJustOrPoison stmChannelBOBIBroadcastChannelBCPhaseNeutralReading Agreement dontWarnMenewBroadcastChannelGHC.EnumData.TraversablemapMseqHead removeHeadaddLast