>>> replicate n = Stream.take n . Stream.repeatGenerate a stream of length n by repeating a value n times.
>>> replicateM n = Stream.take n . Stream.repeatMGenerate a stream by performing a monadic action n times. Same as:
>>> pr n = threadDelay 1000000 >> print nThis runs serially and takes 3 seconds:
>>> Stream.drain $ Stream.fromSerial $ Stream.replicateM 3 $ pr 1 1 1 1This runs concurrently and takes just 1 second:
>>> Stream.drain $ Stream.fromAsync $ Stream.replicateM 3 $ pr 1 1 1 1Concurrent
>>> parReplicateM cfg n = Stream.parSequence cfg . Stream.replicate nExample, parReplicateM in the following example executes all the replicated actions concurrently, thus taking only 1 second:
>>> Stream.fold Fold.drain $ Stream.parReplicateM id 10 $ delay 1 ...