o      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_` 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 { | } ~    Safe-InferredNoneExecute a Reagent. LLike atomicModifyIORef, but uses CAS and permits the update action to force  a retry by returning Nothing None'An entry point for a shared SNZI value *Signal the presence of a thread at a SNZI KSignal the departure of a thread at a SNZI. IMPORTANT: depart MUST NOT be 7 called more times than arrive for a given SNZI value. ICreate a shared SNZI values with numCapabilities number of entry points, - together with a polling action that returns true when no threads are  present.  Safe-Inferred#Is the counter (transiently) zero? NoneCreate an empty bag LAdd an element to a bag, returning a token that can later be used to remove  that element. Lforeach b f will traverse b (concurrently with updates), applying f to each K encountered element, together with a token that can be used to remove the  element. IRemove the element associated with a given token. Repeated removals are  permitted.  NoneHEither the value associated with a key, or else a token at the position  where that key should go. &A position in the map into which a key/%value pair can be inserted what key were we looking up? &the value at this position in the map !the reference at which to insert &a ticket for the old value of nextRef 6A concurrent finite map, represented as a linked list Create a new concurrent map #Attempt to locate a key in the map Attempt to insert a key/3value pair at the given location (where the key is Q given by the token). NB: tryInsert will *always* fail after the first attempt. ] If successful, returns a (mutable!) view of the map beginning at the given key.  Concurrently fold over all key/(value pairs in the map within the given N monad, in increasing key order. Inserts that arrive concurrently may or may  not be included in the fold. Strict in the accumulator.  NMap over a snapshot of the list. Inserts that arrive concurrently may or may T not be included. This does not affect keys, so the physical structure remains the  same.  BCreate a new linked map that is the reverse order from the input.  Convert to a list  Convert from a list. "Attempt to split into two halves. KThis optionally takes an upper bound key, which is treated as an alternate  end-of-list signifier. OResult: If there is only one element, then return Nothing. If there are more, S return the number of elements in the first and second halves, plus a pointer to Q the beginning of the second half. It is a contract of this function that the # two Ints returned are non-zero. QDrop from the front of the list until the first key is equal or greater than the  given key. BGiven a pointer into the middle of the list, find how deep it is. A findIndex :: Eq k => LMList k v -> LMList k v -> IO (Maybe Int)                 Safe-InferredJA typeclass for monads supporting a coin toss operation. NB: the coin is J expected to be core-local, so that flipping by multiple threads does not  cause contention.  Safe-Inferred ! !UnsafeBAn uninhabited type that signals that an LVar is not only frozen, 8 but it may be traversed in whatever order its internal  representation dictates. :This exists only for the purpose of being a type which is not equal to . " One could just as well have used () , but this is more descriptive. ?An uninhabited type that signals that an LVar has been frozen. ) LVars should use this in place of their s parameter. )DeepFreezing is a type-level (guaranteed O(1) time complexity) @ operation. It marks an LVar and its contents (recursively) as C frozen. DeepFreezing is not an action that can be taken directly : by the user, however. Rather, it is the final step in a  runParThenFreeze invocation. ;This type function is public. It maps pre-frozen types to ( frozen ones. It should be idempotent. 'Private: not exported to the end user.  Safe-Inferred,Inclusive range of debug messages to accept H (i.e. filter on priority level). If Nothing, use the default level, K which is (0,N) where N is controlled by the DEBUG environment variable. ; The convention is to use Just (0,0) to disable logging. %Destinations for debug log messages. 1In additional to logging debug messages, control : thread interleaving at these points when this is True. A destination for log messages 8Accumulate output in memory and flush when appropriate. +Printed human-readable output to a handle. Output via GHC's  traceEvent runtime events. All LVar's share a common notion of exceptions. Y The two common forms of exception currently are conflicting-put and put-after-freeze. X There are also errors that correspond to particular invariants for particular LVars.  "    "None#Simple channels that don't support real blocking. $&The state for an exponential backoff. %Maximum nanoseconds to wait. &OWe allow logging in O(1) time in String or ByteString format. In practice the P distinction is not that important, because only *thunks* should be logged; the A thread printing the logs should deal with forcing those thunks. '/This sort of message is chatter and NOT meant 6 to participate in the scheduler-testing framework. & | ByteStrMsg { lvl::Int, } (PSeveral different ways we know to wait for quiescence in the concurrent mutator  before proceeding. )8In this mode, logging calls are non-blocking and return < immediately, rather than waiting on a central coordinator.  This is what we want if we'%re simply printing debugging output, 2 not controlling the schedule for stress testing. *CA fixed set of threads must check-in each round before proceeding. +&How many threads total must check in? ,Poll how many threads won't participate this round. 1 After all productive threads have checked in B this number must grow to eventually include all other threads. -#UNFINISHED: Dynamically track tasks/workers. The . num workers starts at 1 and then is modified  with . and /. 0QA single thread attempting to log a message. It only unblocks when the attached  MVar is filled. 1IA Logger coordinates a set of threads that print debug logging messages. QThis are abstract objects supporting only the operations provided by this module , and the non-hidden fields of the Logger. 2?(private) The thread that chooses which action to unblock next - and handles printing to the screen as well. 3CThe minimum level of messages accepted by this logger (usually 0). 47The maximum level of messages accepted by this logger. 5@The serialized queue of writers attempting to log dbg messages. 6F(public) A method to complete flushing, close down the helper thread,  and generally wrap up. 7<Where to send output. If empty, messages dropped entirely. 8G(private) In-memory buffer of messages, if OutputInMemory is selected. < This is stored in reverse-temporal order during execution. 9CClear buffered log messages and return in the order they occurred. :BCreate a new logger, which includes forking a coordinator thread. T Takes as argument the number of worker threads participating in the computation. ;1Run a logging coordinator thread until completion/ shutdown. <AWrite a log message from the current thread, IF the level of the 4 message falls into the range accepted by the given 1, $ otherwise, the message is ignored. =6Create an object used for exponentential backoff; see >. >3Perform the backoff, possibly delaying the thread. ?Non-blocking read. @LA synchronous read that must block or busy-wait until a value is available. A1Always succeeds. Asynchronous write to channel. *Debugging flag shared by several modules. 9 This is activated by setting the environment variable  DEBUG=1..5. By convention  DEBUG=1004 turns on full sequentialization of the program and T control over the interleavings in concurrent code, enabling systematic debugging  of concurrency problems. B2Exceptions that walk up the fork-tree of threads. KWARNING: By holding onto the ThreadId we keep the parent thread from being O garbage collected (at least as of GHC 7.6). This means that even if it was L complete, it will still be hanging around to accept the exception below. <#$CD%E&'FGHI()*+,-0JKLM1N23456789OPQRST:<What inclusive range of messages do we accept? Defaults to ` (0,dbgLvl)`. ;UV./<W=Maximum delay, nanoseconds >X?@AYZ[B\] $E&'FGHI()*+,-169P:<=>B #$CD%E&G'HIHF(-*)+,0JKLM1 N23456789OPQRST:;UV./<W=>X?@AYZ[B\]Unsafe^The number of this worker _'Total number of workers in this runPar `$core-local random number generation aA thread-local flag bThe thread-local work deque cglobal list of idle workers d"global list of all worker states. eNThe Logger object used by the current Par session, if debugging is activated. fCreate a new local work deque gAdd work to a thread's own work deque hTake work from a thread's own work deque i!Add low-priority work to a thread's own work deque j!Take work from a different thread' s work deque kBProcess the next item on the work queue or, failing that, go into  work-stealing mode. lPAttempt to steal work or, failing that, give up and go idle (and then wake back  up and keep stealing). QThis function does NOT return until the complete runPar session is complete (all  workers idle). m;If any worker is idle, wake one up and give it work to do. n&Create a new set of scheduler states. o:the CPU executing the current thread (0 if not supported) p'Local chatter function for this module qr^_`abcdesfghtijklmunvwxop q^`etkmunvwxoq r^_`abcdesfghtijklmunvwxopUnsafe&yIA monadic type constructor for parallel computations producing an answer a. $ This is the internal, unsafe type. A  HandlerPool@ contains a way to count outstanding parallel computations that P are affiliated with the pool. It detects the condition where all such threads  have completed. z=A listener for an LVar is informed of each change to the LVar's state O (represented as a delta) and the event of the LVar freezing. The listener is K given access to a bag token, allowing it to remove itself from the bag of N listeners, after unblocking a threshold read, for example. It is also given N access to the scheduler queue for the CPU that generated the event, which it  can use to add threads. {NThe frozen bit of an LVar is tied together with the bag of waiting listeners, K which allows the entire bag to become garbage immediately after freezing. " (Note, however, that outstanding put%s that occurred just before freezing N may still reference the bag, which is necessary to ensure that all listeners  are informed of the put prior to freezing.) |,bag of blocked threshold reads and handlers }+further changes to the state are forbidden ~+further changes to the state are forbidden &LVars are parameterized by two types:  The first, a, characterizes the "state" of the LVar (i.e., the lattice O element), and should be a concurrently mutable data type. That means, in  particular, that only a transient snapshot of the state can be N obtained in general. But the information in such a snapshot is always a 3 lower bound on the current value of the LVar.  The second, d, characterizes the "delta" associated with a putLV < operation (i.e., the actual change, if any, to the LVar' s state). N In many cases such deltas allow far more efficient communication between  putLVs and blocked getLV-s or handlers. It is crucial, however, that  the behavior of a get# or handler does not depend on the  particular  choice of putLV8 operations (and hence deltas) that moved the LVar over K the threshold. For simple data structures, the delta may just be the N entire LVar state, but for, e.g., collection data structures, delta will - generally represent a single insertion. Fa global ID that is *not* the name of any LVar. Makes it possible to P represent Maybe (LVarID) with the type LVarID -- i.e., without any allocation. )Logging within the (internal) Par monad. Create an LVar. Do a threshold read on an LVar Update an LVar. .Update an LVar without generating a result. 0Freeze an LVar (introducing quasi-determinism). ' It is the data structure implementor'7s responsibility to expose this as quasi-deterministc. Create a handler pool. !Convenience function. Execute a Par5 computation in the context of a fresh handler pool. !Convenience function. Execute a Par' computation in the context of a fresh = handler pool, while ignoring the result of the computation. Close a Par= task so that it is properly registered with a handler pool. #Add a handler to an existing pool. )Block until a handler pool is quiescent. A global barrier. /Freeze an LVar after a given handler quiesces. BFork a child thread, optionally in the context of a handler pool. Fork a child thread.  Perform an IO action. LIF compiled with debugging support, this will return the Logger used by the C current Par session, otherwise it will simply throw an exception. HReturn the worker that we happen to be running on. (NONDETERMINISTIC.) &Cooperatively schedule other threads. LContract: This scheduler function only returns when ALL worker threads have ! completed their work and idled. 5A variant with full control over the relevant knobs. NReturns a list of flushed debug messages at the end (if in-memory logging was * enabled, otherwise the list is empty). PThis version of runPar catches ALL exceptions that occur within the runPar, and M returns them via an Either. The reason for this is that even if an error T occurs, it is still useful to observe the log messages that lead to the failure. 2Run a deterministic parallel computation as pure. "A version that avoids an internal  for calling " contexts that are already in the  monad. MDebugging aid. Return debugging logs, in realtime order, in addition to the  final result. This is like  but uses the default settings. +Convert from a Maybe back to an exception. .Debugging tool for printing which HandlerPool AFor debugging purposes. This can help us figure out (by an ugly = process of elimination) which MVar reads are leading to a Thread blocked indefinitely exception. HGenerate a random boolean in a core-local way. Fully nondeterministic! Nyz{|}~ the LVar already past threshold?  The Bool' indicates whether the LVar is FROZEN. does d pass the threshold?  the LVar 'how to do the put, and whether the LVar's  value changed  the LVar 'how to do the put, and whether the LVar's  value changed pool to enroll in, if any LVar to listen to 2initial snapshot callback on handler registration subsequent callbacks: updates the LVar of interest 2initial snapshot callback on handler registration subsequent callbacks: updates Debugging config !How many worker threads to use. The computation to run. /Byz{|}~;yz{~}|Unsafe @The generic representation of LVars used by the scheduler. The  end-user can'5t actually do anything with these and should not try  to. $A shorthand for quasi-deterministic  computations. 2The type of parallel computations. A computation  Par d s a may or may not be + deterministic based on the setting of the d parameter (of kind ).  The s+ parameter is for preventing the escape of LVars from Par computations  (just like the ST monad). ;Implementation note: This is a wrapper around the internal ) type, only with more type parameters. )This datatype is promoted to type-level ( DataKinds extension)  and used to indicate whether a  computation is D guaranteed-deterministic, or only quasi-deterministic (i.e., might  throw NonDeterminismExn). 3Unsafe: drops type information to go from the safe  monad to  the internal, dangerous one. <This is cheating! It pays no attention to session sealing (s ) or to the  determinism level (d). NExtract the state of an LVar. This should only be used by implementations of  new LVar data structures. !RIgnore the extra type annotations regarding both determinism and session-sealing. "HUnsafe coercion from quasi-deterministic to deterministic. The user is 9 promising that code is carefully constructed so that put/freeze races will not  occur. #9Unsafe internal operation to lift IO into the Par monad.  !"# !"#!" #  !"# Trustworthy$;It is always safe to lift a deterministic computation to a  quasi-deterministic one. %&Cooperatively schedule other threads. &9Block until a handler pool is quiescent, i.e., until all 2 associated parallel computations have completed. PA global barrier. Wait for all unblocked, active threads of work in the system 1 to complete, and then proceed after that point. '#Execute a computation in parallel. ( A version of '< that also allows the forked computation to be tracked in a   HandlerPoolF, that enables the programmer to synchronize on the completion of the J child computation. But be careful; this does not automatically wait for 4 all downstream forked computations (transitively). )KCreate a new pool that can be used to synchronize on the completion of all 1 parallel computations associated with the pool. *BExecute a Par computation in the context of a fresh handler pool. +HExecute a Par computation in the context of a fresh handler pool, while ) ignoring the result of the computation. ,1If the input computation is quasi-deterministic (), then this may  throw a : nondeterministically on the thread that calls it, but if F it returns without exception then it always returns the same answer. +If the input computation is deterministic (), then runParIO will return the  same result as / . However, , is still possibly useful for  avoiding an extra ' required inside the implementation of  /. In the future, full9 nondeterminism may be allowed as a third setting beyond   and . Useful ONLY for timing. -QUseful for debugging. Returns debugging logs, in realtime order, in addition to  the final result. .5A variant with full control over the relevant knobs. NReturns a list of flushed debug messages at the end (if in-memory logging was * enabled, otherwise the list is empty). PThis version of runPar catches ALL exceptions that occur within the runPar, and M returns them via an Either. The reason for this is that even if an error T occurs, it is still useful to observe the log messages that lead to the failure. /3If a computation is guaranteed-deterministic, then  becomes a dischargeable T effect. This function will create new worker threads and do the work in parallel,  returning the final result. F(For now there is no sharing of workers with repeated invocations; so  keep in mind that runPar' is an expensive operation. [2013.09.27]) 0PLog a line of debugging output. This is only used when *compiled* in debugging ; mode. It atomically adds a string onto an in-memory log.  The provided  , is the  debug level+ associated with the message, 1-5. One is T the least verbose, and five is the most. When debugging, the user can control the 0 debug level by setting the env var DEBUG, e.g. DEBUG=5. LIF compiled with debugging support, this will return the Logger used by the C current Par session, otherwise it will simply throw an exception. 1NLeft-biased parallel for loop. As worker threads beyond the first are added, T this hews closer to the sequential iteration order than an unbiased parallel loop. 1Takes a range as inclusive-start, exclusive-end. 2OThe least-sophisticated form of parallel loop. Fork iterations one at a time. 3NDivide the iteration space recursively, but ultimately run every iteration in N parallel. That is, the loop body is permitted to block on other iterations. 4GSplit the work into a number of tiles, and fork it in a tree topology. 5BA simple for loop for numeric ranges (not requiring deforestation  optimizations like forM$). Inclusive start, exclusive end. $%&'()*+,-.Debugging configuration !How many worker threads to use. The computation to run. /012345$%&'()*+,-./012345$%&'()*+,-./012345 Trustworthy6#Under normal conditions, calling a freeze operation inside a   computation makes the " computation quasi-deterministic. D However, if we freeze only after all LVar operations are completed ' (after the implicit global barrier of  ), then we' ve avoided < all data races, and freezing is therefore safe. Running a   computation with 6 accomplishes this, without our  having to call freeze explicitly. In order to use 6, the type returned from the  % computation must be a member of the  class. All the   Data.LVar.*' libraries should provide instances of  D already. Further, you can create additional instances for custom, " pure datatypes. The result of a 6 depends on the  type-level function &, whose only purpose is to toggle the  s parameters of all IVars to the  state. (Significantly, the freeze at the end of 6 has no runtime cost, in % spite of the fact that it enables a deep* (recursive) freeze of the value returned  by the  computation. 7>This version works for nondeterministic computations as well. 7Of course, nondeterministic computations may also call freeze B internally, but this function has an advantage to doing your own  freeze at the end of a : there is an implicit barrier $ before the final freeze. Further,  has no runtime 0 overhead, whereas regular freezing has a cost. 67676767NoneUnsafe 8 Carries a Foldable type, but you don't get to know which one. $ The purpose of this type is that  sortFreeze should not have 1 to impose a particular memory representation. :0A class enabling generic creation of new LVars. ;.Requirements for contents types of this LVar. =9A class representing monotonic data structures that take one type  parameter, as well as an s parameter for session safety. @LVars that fall into this class are typically collection types. >>Add a handler function which is called whenever an element is  added to the LVar. ?An O(1)4 operation that atomically switches the LVar into a = frozen state. Any threads waiting on the freeze are woken. 4The contents of a frozen LVar are fully observable: 6 e.g., a whole set instead of one element, or the full/empty 7 information for an IVar, instead of just the payload. However, note that / LVars cannot be folded, because they may have 4 nondeterministic ordering after being frozen. See  sortFreeze. @Perform a freeze followed by a sort operation which guarantees G that the elements produced will be produced in a deterministic order. - The result is fully accessible to the user (Foldable). AA safer version of B (that is, with a slightly more constrained type) for LVars only. " Note, that the type of the LVar'Es contents must be allowed to change, because freezing is recursive. BPHere we gain permission to expose the nondeterministic internal structure of an P LVar: namely, the order in which its contents occur. We pay the piper with an   action. 89:;<=>?@AB 89:;<=>?@AB =>?@:;<89AB89:;<=>?@AB TrustworthyC%Some LVar datatypes are stored in an  internally ordered way so " that it is then possible to take O(1)# frozen snapshots and consume them ) inexpensively in a deterministic order. BLVars with this additional property provide this class as well as =. DDon'3t just freeze the LVar, but make the full contents  completely available and Foldable. Guaranteed O(1). E is a stronger property than , so it is always safe to "upcast" to  the weaker version. FLVish G actions must commute, therefore one safe way to consume a frozen (but " unordered) LVar, even in another / session, is to run a  computation for  each element. CDEF 89:;<=>?@CDEF =>?@:;<CD89EFCDEF Trustworthy GAn G is the simplest form of . I#A new IVar that starts out empty. JRead the value in a IVar. The J can only return when the 1 value has been written by a prior or concurrent put to the same  IVar. K$Put a value into an IVar. Multiple Rs to the same IVar T are not allowed, and result in a runtime error, unless the values put happen to be (==). GThis function is always at least strict up to WHNF in the element put. LUA specialized freezing operation for IVars that leaves the result in a handy format (). M/Unpack a frozen IVar (as produced by a generic ? operation) as a more  palatable data structure. NNRegister a handler that fires when the IVar is filled, which, of course, only  happens once. ONA simple future represented as an IVar. The result is fully evaluated before  the child computation returns. P A version of O' that uses only WHNF, rather than full . RFill an G. 2For convenience only; the user could define this. An G= can be treated as a generic container LVar which happens to P contain at most one value! Note, however, that the polymorphic operations are ? less useful than the monomorphic ones exposed by this module.  Physical equality, just as with s. GHIJKLMNOPQR GHIJKLMNOPQR GHIJRKOPQLMNGHIJKLMNOPQRNoneS A parallel AndN operation that can return early---whenever a False appears on either branch. TAnalagous operation for Or. STUVSTUVSTUVNone5 $%&'()*+,-./012345GHIJKLMNOPQRSTUV)$'%/,12345STUV)*+&(0-.    Trustworthy W1An I-Structure, also known as an array of IVars. X$Retrieve the number of slots in the W. Y+Create a new, empty, monotonically growing W of a given size. 0 All entries start off as zero, which must be "bottom". Z:Register handlers on each internal IVar as it is created. 0 This operation should be more efficient than Y followed by \. [O(N)3 complexity, unfortunately. This implementation of W s requires < freezing each of the individual IVars stored in the array. \JAdd an (asynchronous) callback that listens for all new elements added to  the W), optionally enrolled in a handler pool. ]Put a single element in the WA at a given index. That index must be previously empty. (WHNF) - Strict in the element being put in the set. ^Put a single element in the W3 at a given index. This variant is deeply strict (). _FWait for the indexed entry to contain a value, and return that value. 2For convenience only; the user could define this. The W:s in this module also have the special property that they 7 support a freeze operation which immediately yields a Foldable container  without any sorting (see D). An W; can be treated as a generic container LVar. However, the R polymorphic operations are less useful than the monomorphic ones exposed by this  module (e.g.,  forEachHP vs.  addHandler). WXYZ[\pool to enroll in, if any W to listen to  callback ]^_ WXYZ[\]^_ WYZ^]_X\[WXYZ[\]^_  Trustworthy`:The set datatype itself. Like all other LVars, it has an s parameter (like  an STRef) in addition to the a/ parameter that describes the type of elements  in the set.  Performance note: There is only one0 mutable location in this implementation. Thus & it is not a scalable implementation. b0Create a new, empty, monotonically growing set. c2Create a new set populated with initial elements. dACreate a new set drawing initial elements from an existing list. e Freeze an ` after a specified callback/handler is done running. This  differs from f. by not taking an additional action to run in  the context of the handlers. (e s f == f s f ' return ()' ) fPRegister a per-element callback, then run an action in this context, and freeze S when all (recursive) invocations of the callback are complete. Returns the final  value of the provided action. g0Get the exact contents of the set. As with any & quasi-deterministic operation, using g may cause your D program to exhibit a limited form of nondeterminism: it will never B return the wrong answer, but it may include synchronization bugs 3 that can (nondeterministically) cause exceptions. This Data.Set4-based implementation has the special property that + you can retrieve the full set without any , and without A nondeterminism leaking. (This is because the internal order is 6 fixed for the tree-based representation of sets that Data.Set  uses.) hO(1): Convert from an ` to a plain  . # This is only permitted when the ` has already been frozen. / This is useful for processing the result of !. iJAdd an (asynchronous) callback that listens for all new elements added to 1 the set, optionally enrolled in a handler pool. jJAdd an (asynchronous) callback that listens for all new elements added to  the set. kPPut a single element in the set. (WHNF) Strict in the element being put in the  set. l1Wait for the set to contain a specified element. m Wait on the size of the set, not its contents. nQReturn a fresh set which will contain strictly more elements than the input set. I That is, things put in the former go in the latter, but not vice versa. o=Establish a monotonic map between the input and output sets. p)An imperative-style, in-place version of o that takes the output set  as an argument. qQReturn a new set which will (ultimately) contain everything in either input set. rKBuild a new set which will contain the intersection of the two input sets. s(Take the cartesian product of two sets. t,Take the cartesian product of several sets. u Variant of o. that optionally ties the handlers to a pool. v Variant of p. that optionally ties the handlers to a pool. w Variant of qD that optionally ties the handlers in the resulting set to the same . handler pool as those in the two input sets. x Variant of rD that optionally ties the handlers in the resulting set to the same . handler pool as those in the two input sets. y Variant of s. that optionally ties the handlers to a pool. z Variant of t. that optionally ties the handlers to a pool. -For convenience; the user could define this. The `Es in this module also have the special property that they support an  O(1)- freeze operation which immediately yields a Foldable container  (D). An `G can be treated as a generic container LVar. However, the polymorphic N operations are less useful than the monomorphic ones exposed by this module.  Physical identity, just as with s. #`abcdefghipool to enroll in, if any Set to listen to  callback jklmnopqrstuvwxyz    `abcdefghijklmnopqrstuvwxyz`abcdklmjiefghnopqrstuvwxyz"`abcdefghijklmnopqrstuvwxyz     Unsafe{:The map datatype itself. Like all other LVars, it has an s parameter (think  STRef) in addition to the a/ parameter that describes the type of elements  in the set.  Performance note: There is only one0 mutable location in this implementation. Thus & it is not a scalable implementation. };Add an (asynchronous) callback that listens for all new key/value pairs added to 1 the map, optionally enrolled in a handler pool. ~"An unsafe, nonblocking version of getKey. This reveals whether  PA generic initialize proceedure that returns a preexisting value, if it exists,  otherwise filling in a new bottom value and returning it. The boolean return value is True% iff a new, fresh entry was created. 2For convenience only; the user could define this. The {Es in this module also have the special property that they support an  O(1)- freeze operation which immediately yields a Foldable container  (D). An {G can be treated as a generic container LVar. However, the polymorphic N operations are less useful than the monomorphic ones exposed by this module. 'Equality is physical equality, as with IORefs. {|}optional pool to enroll in Map to listen to  callback ~ The key to lookup or populate. {|}~~{|} {|}~   Trustworthy'Create a fresh map with nothing in it. 2Create a new map populated with initial elements. 5A convenience function that is equivalent to calling "#  followed by . PRegister a per-element callback, then run an action in this context, and freeze S when all (recursive) invocations of the callback are complete. Returns the final  value of the provided action. ?Add an (asynchronous) callback that listens for all new new key/value pairs added to  the map. FPut a single entry into the map. Strict (WHNF) in the key and value. SAs with other container LVars, if a key is inserted multiple times, the values had  better be equal (==)%, or a multiple-put error is raised. {Gs containing other LVars have some additional capabilities compared to Q those containing regular Haskell data. In particular, it is possible to modify 2 existing entries (monotonically). Further, this  function implicitly  inserts a "bottom"4 element if there is no existing entry for the key. OUnfortunately, that means that this takes another computation for creating new  "bottom"1 elements for the nested LVars stored inside the {. A generic version of  that does not require a < argument, 7 rather, it uses the generic version of that function. JReturn the preexisting value for a key if it exists, and otherwise return EThis is a convenience routine that can easily be defined in terms of  NWait for the map to contain a specified key, and return the associated value. :Wait until the map contains a certain value (on any key).  Wait on the size of the map, not its contents. 0Get the exact contents of the map. As with any & quasi-deterministic operation, using  may cause your D program to exhibit a limited form of nondeterminism: it will never B return the wrong answer, but it may include synchronization bugs 3 that can (nondeterministically) cause exceptions. This Data.Map4-based implementation has the special property that + you can retrieve the full map without any , and without A nondeterminism leaking. (This is because the internal order is 6 fixed for the tree-based representation of maps that Data.Map  uses.) O(1): Convert from an { to a plain $. # This is only permitted when the { has already been frozen. / This is useful for processing the result of !. PTraverse a frozen map for side effect. This is useful (in comparison with more S generic operations) because the function passed in may see the key as well as the  value. =Establish a monotonic map between the input and output sets. D Produce a new result based on each element, while leaving the keys  the same. )An imperative-style, in-place version of  that takes the output set  as an argument. LReturn a new map which will (ultimately) contain everything in either input D map. Conflicting entries will result in a multiple put exception. MReturn a fresh map which will contain strictly more elements than the input. I That is, things put in the former go in the latter, but not vice versa.  A variant of . that optionally ties the handlers to a pool.  A variant of . that optionally ties the handlers to a pool.  A variant of * that optionally ties the handlers in the B resulting set to the same handler pool as those in the two input  sets. The key to lookup.  Create a new "bottom"+ element whenever an entry is not present. DThe computation to apply on the right-hand side of the keyed entry. The key to lookup. DThe computation to apply on the right-hand side of the keyed entry. {|}{|} NoneMA portion of an SLMap between two keys. If the upper-bound is missing, that  means  go to the end'. The optional lower bound is used to lazily prune the 9 fronts each layer. The reason for this is that we don't want to reallocate an ; IORef spine and prematurely prune all lower layers IF we're simply going to 9 split again before actually enumerating the contents. #The GADT representation. The type t$ gives the type of nodes at a given  level in the skip list. 8Create a new skip list with the given number of levels. $Attempt to locate a key in the map.  Adds a key/@value pair if the key is not present, all within a given monad. ; Returns the value now associated with the key in the map.  Adds a key/@value pair if the key is not present, all within a given monad. ; Returns the value now associated with the key in the map. Concurrently fold over all key/(value pairs in the map within the given N monad, in increasing key order. Inserts that arrive concurrently may or may  not be included in the fold. #Strict in the accumulator. NCreate an identical copy of an (unchanging) SLMap with the keys unchanged and F the values replaced by the result of applying the provided function. < map :: MonadIO m => (a -> b) -> SLMap k a -> m (SLMap k b) EReturns the sizes of the skiplist levels; for performance debugging. <Create a slice corresponding to the entire (non-empty) map. PAttempt to split a slice of an SLMap. If there are not enough elements to form # two slices, this retruns Nothing. O(N)( measure the length of the bottom tier. )Print a slice with each layer on a line. Physical identity The map The key to lookup/insert %A computation of the value to insert The map The key to lookup/insert %A computation of the value to insert 'An explicit, thread-local coin to toss  The map $A shortcut into this skiplist level The key to lookup/insert %A computation of the value to insert A (thread-local) coin tosser &A thunk for inserting into the higher  levels of the skiplist  !" !"  Trustworthy :The set datatype itself. Like all other LVars, it has an s parameter (think  STRef) in addition to the a/ parameter that describes the type of elements  in the set. JPerformance note: this data structure reduces contention between parallel . computations inserting into the map, but all blocking computations are not as R scalable. All continuations waiting for not-yet-present elements will currently ! share a single queue [2013.09.26]. 7Test whether an element is in a frozen image of a set. #&The default number of skiplist levels 0Create a new, empty, monotonically growing set. $NTuning: Create a new, empty, monotonically growing set, with the given number  of skip list levels.  Create a new " populated with initial elements. .A simple convenience function. Create a new 1 drawing initial elements from an existing list. % Create a new 6 drawing initial elements from an existing list, with & the given number of skiplist levels.  Freeze an  after a specified callback/handler is done running. This  differs from . by not taking an additional action to run in  the context of the handlers. ( s f ==  s f ' return ()' ) PRegister a per-element callback, then run an action in this context, and freeze S when all (recursive) invocations of the callback are complete. Returns the final  value of the provided action. JAdd an (asynchronous) callback that listens for all new elements added to 1 the set, optionally enrolled in a handler pool. JAdd an (asynchronous) callback that listens for all new elements added to  the set. PPut a single element in the set. (WHNF) Strict in the element being put in the  set. 1Wait for the set to contain a specified element.  Wait on the size of the set, not its contents. QReturn a fresh set which will contain strictly more elements than the input set. I That is, things put in the former go in the latter, but not vice versa. =Establish a monotonic map between the input and output sets. )An imperative-style, in-place version of  that takes the output set  as an argument. QReturn a new set which will (ultimately) contain everything in either input set. KBuild a new set which will contain the intersection of the two input sets. (Take the cartesian product of two sets. ,Take the cartesian product of several sets.  Variant of . that optionally ties the handlers to a pool.  Variant of . that optionally ties the handlers to a pool. &KVariant that optionally ties the handlers in the resulting set to the same . handler pool as those in the two input sets. 'KVariant that optionally ties the handlers in the resulting set to the same . handler pool as those in the two input sets.  Variant of . that optionally ties the handlers to a pool.  Variant of . that optionally ties the handlers to a pool. (2For convenience only; the user could define this. )The Es in this module also have the special property that they support an  O(1)- freeze operation which immediately yields a Foldable container  (D). *An - can be treated as a generic container LVar. + Physical identity, just as with IORefs. %,#$%optional pool to enroll in Set to listen to  callback &'-.(/0)*+$,#$%&'-.(/0)*+%Unsafe Trustworthy:The map datatype itself. Like all other LVars, it has an s parameter (think  STRef) in addition to the a/ parameter that describes the type of elements  in the set. JPerformance note: this data structure reduces contention between parallel . computations inserting into the map, but all blocking computations are not as R scalable. All continuations waiting for not-yet-present elements will currently ! share a single queue [2013.09.26]. 1&The default number of skiplist levels 'Create a fresh map with nothing in it. 2ICreate a fresh map with nothing in it, with the given number of skiplist  levels. 2Create a new map populated with initial elements. ACreate a new map drawing initial elements from an existing list. 3FCreate a new map drawing initial elements from an existing list, with ' the given number of skip list levels. PRegister a per-element callback, then run an action in this context, and freeze S when all (recursive) invocations of the callback are complete. Returns the final  value of the provided action. ;Add an (asynchronous) callback that listens for all new key/ value pairs 6 added to the map, optionally tied to a handler pool. ?Add an (asynchronous) callback that listens for all new new key/value pairs added to  the map. FPut a single entry into the map. (WHNF) Strict in the key and value. Gs containing other LVars have some additional capabilities compared to Q those containing regular Haskell data. In particular, it is possible to modify 2 existing entries (monotonically). Further, this  function implicitly  inserts a "bottom"4 element if there is no existing entry for the key. NWait for the map to contain a specified key, and return the associated value. :Wait until the map contains a certain value (on any key). /Wait on the SIZE of the map, not its contents. 0Get the exact contents of the map. As with any & quasi-deterministic operation, using  may cause your D program to exhibit a limited form of nondeterminism: it will never B return the wrong answer, but it may include synchronization bugs 3 that can (nondeterministically) cause exceptions.  This is an O(1) operation that doesn'+t copy the in-memory representation of the  IMap. PTraverse a frozen map for side effect. This is useful (in comparison with more S generic operations) because the function passed in may see the key as well as the  value. QEstablish a monotonic map between the input and output map Produce a new result 9 based on each element, while leaving the keys the same. )An imperative-style, in-place version of  that takes the output map  as an argument. MReturn a fresh map which will contain strictly more elements than the input. I That is, things put in the former go in the latter, but not vice versa.  Variant of . that optionally ties the handlers to a pool.  Variant of . that optionally ties the handlers to a pool. LReturn a new map which will (ultimately) contain everything in either input F map. Conflicting entries will result in a multiple put exception. + Optionally ties the handlers to a pool. 42For convenience only; the user could define this. 5The Es in this module also have the special property that they support an  O(1)- freeze operation which immediately yields a Foldable container  (D). 6An G can be treated as a generic container LVar. However, the polymorphic N operations are less useful than the monomorphic ones exposed by this module. 7'Equality is physical equality, as with IORefs. !8123optional pool to enroll in Map to listen to  callback The key to lookup.  Create a new "bottom"+ element whenever an entry is not present. DThe computation to apply on the right-hand side of the keyed entry. 49:;<567 812349:;<567Unsafe PAn LVar which consists merely of an immutable, pure value inside a mutable box. @Takes a finite set of states and a join operation (e.g., for an B instance of JoinSemiLattice) and returns an error message if the  join-semilattice properties don't hold. >Verify that a blocking get is monotone in just the right way. 3 This takes a designated bottom and top element. ;A new pure LVar populated with the provided initial state. Blocks until the contents of lv are at or above one element of  thrshSet!, then returns that one element. =%Returns the element of thrshSet that  currentState is above, if < it exists. (Assumes that there is only one such element!) Like < but uses a threshold function rather than an explicit set. LWait until the pure LVar has crossed a threshold and then unblock. (In the , semantics, this is a singleton query set.) 3Put a new value which will be joined with the old. 1Freeze the pure LVar, returning its exact value.  Subsequent puts will raise an error. > Physical identity, just as with s. =?@>A =?@>A&NoneBCDEFGBCDEFGBCDEFGH'()*+,--./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[!\]]^_`abcdefghijkklmnopqrstuvwxyz{|}~num               llu#      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHlI0JJKLMNOP?QRSTU;VWXYZ[\OPQ]bL^_NMI`aKbTURcdefghSijklmnopqrrs?t:uvQwxy;F<z{|}~l^fg`fccyq|z                                         &&&&&& lvish-1.1.2Control.LVish.DeepFrz.Internal Control.LVishControl.LVish.InternalControl.LVish.DeepFrzData.LVar.Generic.InternalData.LVar.GenericData.LVar.IVarData.LVar.IStructureData.LVar.PureSetData.LVar.PureMap.UnsafeData.LVar.PureMapData.Concurrent.SkipListMapData.LVar.SLSetData.LVar.SLMapData.LVar.Internal.PureData.Concurrent.AlignedIORefControl.ReagentData.Concurrent.SNZIData.Concurrent.CounterData.Concurrent.BagData.Concurrent.LinkedMapControl.LVish.MonadTossData.UtilInternalControl.LVish.TypesControl.LVish.Logging%Control.LVish.SchedIdempotentInternalControl.LVish.SchedIdempotentControl.LVish.BasicsControl.LVish.UnsafeControl.LVish.LogicalDataSetrunParThenFreezeData.MapfromListMapData.LVar.SLMap.UnsafeData.LVar.PairTrvrsblNonFrznFrznDeepFrzFrzTypefrzDbgCfgdbgRangedbgDests dbgSchedulingOutDestOutputInMemoryOutputTo OutputEventsLVishExceptionLVarSpecificExnPutAfterFreezeExnConflictingPutExndbgLvl HandlerPoolLVarWrapLVar unWrapLVarQParParWrapPar DeterminismQuasiDetDet unWrapPar unsafeRunParstate unsafeConvert unsafeDetliftIOliftQDyieldquiesceforkforkHPnewPool withNewPool withNewPool_runParIO runParLoggedrunParDetailedrunParlogDbgLnparForL parForSimple parForTree parForTiledfor_runParThenFreezeIO AFoldable LVarWBottom LVContents newBottom LVarData1 addHandlerfreezesortFrznunsafeCoerceLVarunsafeTraversableOrderedLVarData1 snapFreezecastFrznforFrznIVarnewgetput_ freezeIVarfromIVarwhenFullspawnspawn_spawnPputasyncAndasyncOrandMaporMap IStructure getLength newIStructurenewIStructureWithCallbackfreezeIStructure forEachHPISet newEmptySetnewSet newFromListfreezeSetAfterwithCallbacksThenFreeze freezeSetfromISetforEachinsertwaitElemwaitSizecopy traverseSet traverseSet_union intersection cartesianProdcartesianProds traverseSetHPtraverseSetHP_unionHPintersectionHPcartesianProdHPcartesianProdsHPIMap unsafePeekKey newEmptyMapnewMapmodifygmodify getOrInitgetKey waitValue freezeMapfromIMap traverseFrzn_ traverseMap traverseMap_ traverseMapHPtraverseMapHP_ PutResultFoundAdded SLMapSliceSliceSLMapnewSLMapfind putIfAbsentputIfAbsentToss foldlWithKeycountstoSlice splitSlice sliceSize debugShowmember levelCountsPureLVarverifyFiniteJoinverifyFiniteGet newPureLVar getPureLVarunsafeGetPureLVar waitPureLVar putPureLVarfreezePureLVar AlignedIORefrefnewAlignedIORefreact atomicUpdateReagent atomicUpdate_ postCommitchoiceSNZIarrivedepartnewSNZI TellParentErrNoYesRootChildmakeTreepollCounterincdecforeachremoveBagTokenUID atomicIncruidCntrgetUID FindResult keyToInsertvaluenextRef nextTicketLMListnewLMap tryInsertmapreversetoListhalve dropUntil findIndexNotFoundLMapEmptyNodeheadhalve' MonadTosstoss $fMonadTossIO Traverse_ runTraverse_traverseWithKey_myfoldMapWithKey$fMonoidTraverse_$fExceptionLVishExceptionSmplChanBackoffcapLogMsg OffTheRecordWaitModeDontWaitWaitNum numThreads downThreads WaitDynamic incrTasks decrTasksWriterLogger coordinatorminLvlmaxLvl checkPointcloseIt loutDestslogged flushLogs newLoggerrunCoordinatorlogOn newBackoffbackofftryReadSmplChan readSmplChan writeSmplChanforkWithExceptionscurrent totalWaitobodStrMsglvlbodywhocontinuemsg waitWorkersmapMsgtoStringmaxWaitandMcatchAllchatter printNTrace dummyMVar newSmplChantheEnv defaultDbg replayDbg$fShowIO $fShowIO0no numWorkersprngstatusworkpoolidlestatesloggernewDequepushMinepopMine pushYieldpopOthernextstealpushWork currentCPUStateDequenullQ yieldWorknumber setStatusawaitListenerStatusActiveFrozenFreezingnoNamelogStrLnnewLVgetLVputLV_putLVfreezeLV closeInPool quiesceAll freezeLVAfter getLogger getWorkerNumschedbaseGHC.IOunsafePerformIOghc-prim GHC.TypesIO fromRighthpId_ busyTakeMVar$fMonadTossPar DecStatus HasNotDecHasDec DedupCell SchedState ClosedParexecclose numHandlersblockedOnQuiesceonUpdateonFreezeLVarIDnamenewLVIDmkParwhenJustisFrozen logHelperlogWith logOffRecord newDedupCheck winnerCheck defaultRunatomicModifyIORef_ unsafeNamehpMsghpId dbgTakeMVar $fNFDataLVar$fApplicativePar $fMonadPar $fFunctorPar runParIO_Int$fDeepFrz(,,,,,,,,)$fDeepFrz(,,,,,,,)$fDeepFrz(,,,,,,)$fDeepFrz(,,,,,)$fDeepFrz(,,,,)$fDeepFrz(,,,) $fDeepFrz(,,) $fDeepFrz(,)$fDeepFrzEither$fDeepFrzMaybe $fDeepFrz[]$fDeepFrzOrdering $fDeepFrz()$fDeepFrzDouble$fDeepFrzFloat$fDeepFrzInteger $fDeepFrzChar $fDeepFrzBool$fDeepFrzWord64$fDeepFrzWord32$fDeepFrzWord16$fDeepFrzWord8 $fDeepFrzWord$fDeepFrzInt64$fDeepFrzInt32$fDeepFrzInt16 $fDeepFrzInt8 $fDeepFrzInt $fMonadIOParGHC.Prim unsafeCoerce#$fShowAFoldable Data.MaybeMaybedeepseq-1.3.0.1Control.DeepSeqNFData $fShowIVar$fLVarData1IVar$fEqIVar GHC.IORefIORef $fShowIVar0$fFoldableIVar $fDeepFrzIVar$fLVarWBottomIVar makeMapperfastChopio$fShowIStructure$fOrderedLVarData1IStructure$fLVarData1IStructure$fShowIStructure0$fDeepFrzIStructure$fFoldableIStructure$fFoldableIStructure0$fEqIStructure $fShowISet$fOrderedLVarData1ISet$fLVarData1ISet$fEqISet $fShowISet0 $fDeepFrzISet$fFoldableISet$fFoldableISet0unsafeGetOrInit $fShowIMap$fOrderedLVarData1IMap$fLVarData1IMap$fEqIMap $fShowIMap0 $fDeepFrzIMap$fFoldableIMap$fFoldableIMap0SLMap_ $fEqSLMapIndexBottomfind_ putIfAbsent_counts_ sliceToList $fShowLMList $fShowIORef defaultLevels newEmptySet_ newFromList_ newEmptyMap_checkThresholds $fEqPureLVar logDbgLn_$fDeepFrzPureLVar$fShowPureLVarIPairnewPairputFstputSndgetFstgetSnd