@@ -72,6 +72,9 @@ pipeline, just the standard forward (`$`) or reverse (`&`) function application
7272operator is enough. Combinators are provided in `Streamly.Prelude` to
7373transform or fold streams.
7474
75+This snippet reads numbers from stdin, prints the squares of even numbers and
76+exits if an even number more than 9 is entered.
77+
7578```haskell
7679import Streamly
7780import qualified Streamly.Prelude as S
@@ -112,9 +115,9 @@ import qualified Streamly.Prelude as S
112115import Control.Concurrent
113116
114117delay n = S.once $ do
115− threadDelay (n * 1000000)
116− tid <- myThreadId
117− putStrLn (show tid ++ ": Delay " ++ show n)
118+ threadDelay (n * 1000000)
119+ tid <- myThreadId
120+ putStrLn (show tid ++ ": Delay " ++ show n)
118121```
119122### Serial
120123
@@ -203,7 +206,7 @@ main = do
203206 s <- S.sum $ asyncly $ do
204207 -- Each square is performed concurrently, (<>) is concurrent
205208 x2 <- foldMap (\x -> return $ x * x) [1..100]
206− y2 <- foldMap (\y -> return $ x * x) [1..100]
209+ y2 <- foldMap (\y -> return $ y * y) [1..100]
207210 -- Each addition is performed concurrently, monadic bind is concurrent
208211 return $ sqrt (x2 + y2)
209212 print s
@@ -215,6 +218,7 @@ example, to concurrently list the contents of a directory tree recursively:
215218``` haskell
216219import Path.IO (listDir, getCurrentDir)
217220import Streamly
221+import qualified Streamly.Prelude as S
218222
219223main = runStream $ asyncly $ getCurrentDir >>= readdir
220224 where readdir d = do
@@ -226,7 +230,7 @@ main = runStream $ asyncly $ getCurrentDir >>= readdir
226230
227231In the above examples we do not think in terms of threads, locking or
228232synchronization, rather we think in terms of what can run in parallel, the rest
229−is taken care of automatically. When using `coparallely` the programmer does
233+is taken care of automatically. When using `asyncly` the programmer does
230234not have to worry about how many threads are to be created they are
231235automatically adjusted based on the demand of the consumer.
232236