transient-0.5.4: composing programs with multithreading, events and distributed computing

Safe HaskellNone
LanguageHaskell2010

Transient.Indeterminism

Description

Synopsis

Documentation

choose :: Show a => [a] -> TransIO a Source #

slurp a list of values and process them in parallel . To limit the number of processing threads, use threads

choose' :: [a] -> TransIO a Source #

alternative definition with more parallelism, as the composition of n async sentences

collect' :: Int -> Int -> TransIO a -> TransIO [a] Source #

search with a timeout After the timeout, it stop unconditionally and return the current results. It also stops as soon as there are enough results specified in the first parameter. The results are returned by the original thread

    timeout t proc=do
      r <- collect' 1 t proc
      case r of
         []  ->  empty
         r:_ -> return r
    timeout 10000 empty <|> liftIO (print "timeout")

That executes the alternative and will print "timeout". This would not be produced if collect would not return the results to the original thread

search is executed in different threads and his state is lost, so don't rely in state to pass information

group :: Int -> TransIO a -> TransIO [a] Source #

group the output of a possible multithreaded process in groups of n elements.

groupByTime :: Integer -> TransIO a -> TransIO [a] Source #

group result for a time interval, measured with diffUTCTime