Safe Haskell | Trustworthy |
---|---|
Language | Haskell98 |
Control.CUtils.Conc
Description
A module of concurrent higher order functions.
- data ExceptionList = ExceptionList [SomeException]
- data ConcException = ConcException
- assocFold :: Concurrent (Kleisli m) => (b -> b -> m b) -> (c -> b) -> (b, Array Int c) -> m b
- class Concurrent a where
- concF_ :: (?seq :: Bool, Concurrent (Kleisli m)) => Int -> (Int -> m ()) -> m ()
- concF :: (?seq :: Bool, Concurrent (Kleisli m)) => Int -> (Int -> m t) -> m (Array Int t)
- conc_ :: (?seq :: Bool, Concurrent (Kleisli m)) => Array Int (m ()) -> m ()
- conc :: (?seq :: Bool) => Array Int (IO e) -> IO (Array Int e)
- concP :: (Monad m, Concurrent (Kleisli m)) => m t -> m t1 -> m (t, t1)
- progressConcF :: (?seq :: Bool) => Int -> (Int -> IO t) -> IO (Array Int t)
- oneOfF :: Concurrent (Kleisli m) => Int -> (Int -> m b) -> m b
- oneOf :: Array Int (IO a) -> IO a
Documentation
data ExceptionList Source
For exceptions caused by caller code.
Constructors
ExceptionList [SomeException] |
Instances
data ConcException Source
For internal errors. If a procedure throws this, some threads it created may still be running. It is thrown separately from ExceptionList.
Constructors
ConcException |
Instances
assocFold :: Concurrent (Kleisli m) => (b -> b -> m b) -> (c -> b) -> (b, Array Int c) -> m b Source
class Concurrent a where Source
A type class of arrows that support some form of concurrency.
Methods
arr_assocFold :: a (b, b) b -> (c -> b) -> a (b, Array Int c) b Source
Runs an associative folding function on the given array. Note: this function only spawns enough threads to make effective use of the capabilities. Any two list elements may be processed sequentially or concurrently. To get parallelism, you have to set the numCapabilities value, e.g. using GHC's +RTS -N flag.
arr_concF_ :: (?seq :: Bool) => a (t, Int) () -> a (t, Int) () Source
The first parameter is the number of computations which are indexed from 0 to n - 1.
arr_concF :: (?seq :: Bool) => a (u, Int) t -> a (u, Int) (Array Int t) Source
arr_oneOfF :: a (u, Int) b -> a (u, Int) b Source
Instances
Concurrent (->) Source | |
Concurrent Res Source | |
Concurrent (Kleisli IO) Source |
conc :: (?seq :: Bool) => Array Int (IO e) -> IO (Array Int e) Source
The next function takes an implicit parameter ?seq. Set it to True if you want to only spawn threads for the capabilities (same as assocFold; good for speed). If you need all the actions to be executed concurrently, set it to False.
concP :: (Monad m, Concurrent (Kleisli m)) => m t -> m t1 -> m (t, t1) Source
Version of concF specialized for two computations.