Hoogle Search
Within LTS Haskell 24.68 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
timeoutThread :: Rational -> Program τ α -> Program τ αcore-program Core.Program.Threads Run a program that needs to complete before the given number of seconds have elapsed. This will return the result of the sub program or throw the Timeout exception if the limit is exceeded.
waitThread :: Thread α -> Program τ αcore-program Core.Program.Threads Wait for the completion of a thread, returning the result. This is a blocking operation. If the thread you are waiting on throws an exception it will be rethrown by waitThread. If the current thread making this call is cancelled (as a result of being on the losing side of concurrentThreads or raceThreads for example, or due to the current scope exiting), then the thread you are waiting on will be cancelled too. This is necessary to ensure that child threads are not leaked if you nest forkThreads.
waitThread' :: Thread α -> Program τ (Either SomeException α)core-program Core.Program.Threads Wait for a thread to complete, returning the result if the computation was successful or the exception if one was thrown by the child thread. This basically is convenience for calling waitThread and putting catch around it, but as with all the other wait* functions this ensures that if the thread waiting is killed the cancellation is propagated to the thread being watched as well.
waitThread_ :: Thread α -> Program τ ()core-program Core.Program.Threads Wait for the completion of a thread, discarding its result. This is particularly useful at the end of a do-block if you're waiting on a worker thread to finish but don't need its return value, if any; otherwise you have to explicily deal with the unused return value:
_ <- waitThread t1 return ()
which is a bit tedious. Instead, you can just use this convenience function:waitThread_ t1
The trailing underscore in the name of this function follows the same convetion as found in Control.Monad, which has mapM_ which does the same as mapM but which likewise discards the return value.waitThreads' :: [Thread α] -> Program τ [Either SomeException α]core-program Core.Program.Threads Wait for many threads to complete. This function is intended for the scenario where you fire off a number of worker threads with forkThread but rather than leaving them to run independantly, you need to wait for them all to complete. The results of the threads that complete successfully will be returned as Right values. Should any of the threads being waited upon throw an exception, those exceptions will be returned as Left values. If you don't need to analyse the failures individually, then you can just collect the successes using Data.Either's rights:
responses <- waitThreads' info "Aggregating results..." combineResults (rights responses)
Likewise, if you do want to do something with all the failures, you might find lefts useful:mapM_ (warn . intoRope . displayException) (lefts responses)
If the thread calling waitThreads' is cancelled, then all the threads being waited upon will also be cancelled. This often occurs within a timeout or similar control measure implemented using raceThreads_. Should the thread that spawned all the workers and is waiting for their results be told to cancel because it lost the "race", the child threads need to be told in turn to cancel so as to avoid those threads being leaked and continuing to run as zombies. This function takes care of that. (this extends waitThread' to work across a list of Threads, taking care to ensure the cancellation behaviour described throughout this module)socketReader :: forall (m :: Type -> Type) . MonadIO m => Socket -> Producer ByteString m ()daemons Control.Pipe.Socket Stream data from the socket.
mapReader :: (a -> b) -> Reader r a -> Reader r bdunai Control.Monad.Trans.MSF.Reader Transform the value returned by a Reader.
mapReaderT :: (m a -> n b) -> ReaderT r m a -> ReaderT r n bdunai Control.Monad.Trans.MSF.Reader Transform the computation inside a ReaderT.
runReaderT (mapReaderT f m) = f . runReaderT m
runReader :: Reader r a -> r -> adunai Control.Monad.Trans.MSF.Reader Runs a Reader and extracts the final value from it. (The inverse of reader.)
runReaderS :: forall (m :: Type -> Type) r a b . Monad m => MSF (ReaderT r m) a b -> MSF m (r, a) bdunai Control.Monad.Trans.MSF.Reader Build an MSF that takes an environment as an extra input from one on the Reader monad. This is the opposite of readerS.