úÎ!Ž ‰”G      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEF(c) Simon Marlow 2012BSD3 (see the file LICENSE)!Simon Marlow <marlowsd@gmail.com> provisional#non-portable (requires concurrency) TrustworthyCDQV‡È8asyncA value of type Concurrently a is an IO, operation that can be composed with other  Concurrently values, using the  Applicative and  Alternative instances.Calling runConcurrently on a value of type Concurrently a will execute the IOL operations it contains concurrently, before delivering the result of type a. For example ¢(page1, page2, page3) <- runConcurrently $ (,,) <$> Concurrently (getURL "url1") <*> Concurrently (getURL "url2") <*> Concurrently (getURL "url3")asyncThe exception thrown by  to terminate a thread.async"An asynchronous action spawned by   or °. Asynchronous actions are executed in a separate thread, and operations are provided for waiting for asynchronous actions to complete and obtaining their results (see e.g. ).async Returns the G" of the thread running the given . async Compare two s that may have different types async2Spawn an asynchronous action in a separate thread. asyncLike   but using H internally. asyncLike   but using I internally. asyncLike   but using Ji internally. The child thread is passed a function that can be used to unmask asynchronous exceptions.asyncLike   but using Ki internally. The child thread is passed a function that can be used to unmask asynchronous exceptions.asyncASpawn an asynchronous action in a separate thread, and pass its AsyncV handle to the supplied function. When the function returns or throws an exception,  is called on the Async. ~withAsync action inner = mask $ \restore -> do a <- async (restore action) restore inner `finally` uninterruptibleCancel aThis is a useful variant of   that ensures an Async( is never left running unintentionally.GNote: a reference to the child thread is kept alive until the call to  returns, so nesting many  calls requires linear memory.asyncLike  but uses H internally.asyncLike  but uses I internally.asyncLike  but uses Ji internally. The child thread is passed a function that can be used to unmask asynchronous exceptions.asyncLike  but uses Kh internally. The child thread is passed a function that can be used to unmask asynchronous exceptionsasync˜Wait for an asynchronous action to complete, and return its value. If the asynchronous action threw an exception, then the exception is re-thrown by . wait = atomically . waitSTMasync@Wait for an asynchronous action to complete, and return either Left e# if the action raised an exception e, or Right a if it returned a value a. %waitCatch = atomically . waitCatchSTMasyncCheck whether an F has completed yet. If it has not completed yet, then the result is Nothing, otherwise the result is Just e where e is Left x if the Async raised an exception x, or Right a if it returned a value a. poll = atomically . pollSTMasync A version of , that can be used inside an STM transaction.async A version of , that can be used inside an STM transaction.async A version of , that can be used inside an STM transaction.async.Cancel an asynchronous action by throwing the AsyncCancelled' exception to it, and waiting for the ' thread to quit. Has no effect if the  has already completed. Bcancel a = throwTo (asyncThreadId a) AsyncCancelled <* waitCatch a Note that ) will not terminate until the thread the , refers to has terminated. This means that U will block for as long said thread blocks when receiving an asynchronous exception.For example, it could block if:SIt's executing a foreign call, and thus cannot receive the asynchronous exception;fIt's executing some cleanup handler after having received the exception, and the handler is blocking.asyncCancel an asynchronous actionThis is a variant of , but it is not interruptible.asyncHCancel an asynchronous action by throwing the supplied exception to it. ,cancelWith a x = throwTo (asyncThreadId a) x*The notes about the synchronous nature of  also apply to .asyncgWait for any of the supplied asynchronous operations to complete. The value returned is a pair of the ; that completed, and the result that would be returned by  on that . If multiple Zs complete or have completed, then the value returned corresponds to the first completed  in the list.async A version of , that can be used inside an STM transaction.asyncLike S, but also cancels the other asynchronous operations as soon as one has completed. asyncWait for any of the supplied Asyncds to complete. If the first to complete throws an exception, then that exception is re-thrown by  . If multiple Zs complete or have completed, then the value returned corresponds to the first completed  in the list.!async A version of  , that can be used inside an STM transaction."asyncLike  S, but also cancels the other asynchronous operations as soon as one has completed.#asyncWait for the first of two Async s to finish.$async A version of #, that can be used inside an STM transaction.%asyncLike # , but also s both Asyncs before returning.&asyncWait for the first of two Asyncs to finish. If the AsyncO that finished first raised an exception, then the exception is re-thrown by &.'async A version of &, that can be used inside an STM transaction.(asyncLike &, but the result is ignored.)async A version of (, that can be used inside an STM transaction.*asyncLike & , but also s both Asyncs before returning.+asyncWaits for both Async|s to finish, but if either of them throws an exception before they have both finished, then the exception is re-thrown by +.,async A version of +, that can be used inside an STM transaction.-asyncLink the given Async* to the current thread, such that if the AsyncZ raises an exception, that exception will be re-thrown in the current thread, wrapped in .- ignores > exceptions thrown in the other thread, so that it's safe to C a thread you're linked to. If you want different behaviour, use L.LasyncLink the given Async* to the current thread, such that if the AsyncÄ raises an exception, that exception will be re-thrown in the current thread. The supplied predicate determines which exceptions in the target thread should be propagated to the source thread..async Link two Asynccs together, such that if either raises an exception, the same exception is re-thrown in the other Async, wrapped in .. ignores ' exceptions, so that it's possible to T either thread without cancelling the other. If you want different behaviour, use M./asyncRun two IOR actions concurrently, and return the first to finish. The loser of the race is led. Urace left right = withAsync left $ \a -> withAsync right $ \b -> waitEither a b0asyncLike /, but the result is ignored.1asyncRun two IO~ actions concurrently, and return both results. If either action throws an exception at any time, then the other action is (led, and the exception is re-thrown by 1. [concurrently left right = withAsync left $ \a -> withAsync right $ \b -> waitBoth a b2asyncmaps an IO-performing function over any  Traversable data type, performing all the IOn actions concurrently, and returning the original data structure with the arguments replaced by the results.oIf any of the actions throw an exception, then all other actions are cancelled and the exception is re-thrown. For example, mapConcurrently works with lists: 8pages <- mapConcurrently getURL ["url1", "url2", "url3"]3async3 is 2 with its arguments flipped Fpages <- forConcurrently ["url1", "url2", "url3"] $ \url -> getURL url4async4 is 23 with the return value discarded, just like @mapM_5async5 is 33 with the return value discarded, just like @forM_6async1, but ignore the result values7async2Perform the action in the given number of threads.8asyncSame as 7, but ignore the results.Nasync¾Fork a thread that runs the supplied action, and if it raises an exception, re-runs the action. The thread terminates only when the action runs to completion without raising an exception.@asyncAasyncOnly defined by async for  base >= 4.9Lasyncreturn O) if the exception should be propagated, P otherwise.9  !"#$%&'()*+,-./0123456789  "&#*%(+!'$),-./016234578 Q      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHFIJFGKFGLFGMNOPQRSQRTU"async-2.2.1-85vFFM3yC751UoHYmbAgP1Control.Concurrent.Async ConcurrentlyrunConcurrentlyExceptionInLinkedThreadAsyncCancelledAsync asyncThreadId compareAsyncsasync asyncBoundasyncOnasyncWithUnmaskasyncOnWithUnmask withAsyncwithAsyncBound withAsyncOnwithAsyncWithUnmaskwithAsyncOnWithUnmaskwait waitCatchpollwaitSTM waitCatchSTMpollSTMcanceluninterruptibleCancel cancelWith waitAnyCatchwaitAnyCatchSTMwaitAnyCatchCancelwaitAny waitAnySTM waitAnyCancelwaitEitherCatchwaitEitherCatchSTMwaitEitherCatchCancel waitEither waitEitherSTM waitEither_waitEitherSTM_waitEitherCancelwaitBoth waitBothSTMlinklink2racerace_ concurrentlymapConcurrentlyforConcurrentlymapConcurrently_forConcurrently_ concurrently_replicateConcurrentlyreplicateConcurrently_$fFunctorAsync$fHashableAsync $fOrdAsync $fEqAsync$fExceptionAsyncCancelled"$fExceptionExceptionInLinkedThread$fShowExceptionInLinkedThread$fMonoidConcurrently$fSemigroupConcurrently$fAlternativeConcurrently$fApplicativeConcurrently$fFunctorConcurrently$fShowAsyncCancelled$fEqAsyncCancelledbase GHC.Conc.SyncThreadIdControl.ConcurrentforkOSforkOnforkIOWithUnmaskforkOnWithUnmasklinkOnly link2Only forkRepeatghc-prim GHC.TypesTrueFalse