Hoogle Search
Within LTS Haskell 24.52 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
maybeReader :: (String -> Maybe a) -> ReadM aconfiguration-tools Configuration.Utils.CommandLine Convert a function producing a Maybe into a reader.
module Configuration.Utils.Internal.
ConfigFileReader No documentation available.
validateFileReadable :: (MonadError Text m, MonadIO m) => Text -> FilePath -> m ()configuration-tools Configuration.Utils.Validation No documentation available.
sleepThread :: Rational -> Program τ ()core-program Core.Program.Execute Pause the current thread for the given number of seconds. For example, to delay a second and a half, do:
sleepThread 1.5
(this wraps base's threadDelay)-
Utility functions for running Program actions concurrently. Haskell uses green threads: small lines of work that are scheduled down onto actual execution contexts (set by default by this library to be one per core). Haskell threads are incredibly lightweight, and you are encouraged to use them freely. Haskell provides a rich ecosystem of tools to do work concurrently and to communicate safely between threads. This module provides wrappers around some of these primatives so you can use them easily from the Program monad. Note that when you fire off a new thread the top-level application state is shared; it's the same τ inherited from the parent Program.
-
core-program Core.Program.Threads A thread for concurrent computation. (this wraps base's ThreadId along with a holder for the result of the thread)
-
core-program Core.Program.Threads No documentation available.
cancelThread :: Thread α -> Program τ ()core-program Core.Program.Threads Cancel a thread. Be careful when using this. If you are planning cancel a worker thread then the main thread that is waitThreading on it will throw an exception, specifically ThreadCancelled (unless something else has already thrown an exception in which case that will be thrown instead). In this scenario you will need to catch around your waiting function otherwise the uncaught exception will continue to unwind your execution stack and probably end your program. (this wraps base's killThread. The underlying mechanism used is to throw the ThreadKilled exception to the other thread. That exception is asynchronous, so will not be trapped by a catch block and will indeed cause the thread receiving the exception to come to an end)
concurrentThreads :: Program τ α -> Program τ β -> Program τ (α, β)core-program Core.Program.Threads Fork two threads and wait for both to finish. The return value is the pair of each action's return types. This is the same as calling forkThread and waitThread twice, except that if either sub-program fails with an exception the other program which is still running will be cancelled and the original exception is then re-thrown.
(a,b) <- concurrentThreads one two -- continue, doing something with both results.
For a variant that ingores the return values and just waits for both see concurrentThreads_ below.concurrentThreads_ :: Program τ α -> Program τ β -> Program τ ()core-program Core.Program.Threads Fork two threads and wait for both to finish. This is the same as calling forkThread and waitThread_ twice, except that if either sub-program fails with an exception the other program which is still running will be cancelled and the original exception is then re-thrown.