@@ -29,18 +29,17 @@
2929-- allows high performance combinatorial programming even when using byte level
3030-- streams. Streamly API is similar to Haskell lists.
3131--
32−-- Streams can be constructed
33−-- like lists, except that they use 'nil' instead of '[]' and 'cons' instead of
34−-- ':'.
32+-- Streams can be constructed like lists, except that they use 'nil' instead of
33+-- '[]' and 'cons' instead of ':'.
3534--
36−-- `cons` constructs a pure stream which is more or less the same as a list:
35+-- `cons` adds a pure value at the head of the stream:
3736--
3837-- >>> import Streamly.Data.Stream (Stream, cons, consM, nil)
3938-- >>> stream = 1 `cons` 2 `cons` nil :: Stream IO Int
4039-- >>> Stream.fold Fold.toList stream -- IO [Int]
4140-- [1,2]
4241--
43−-- 'consM' constructs a stream from effectful actions:
42+-- `consM` adds an effect at the head of the stream:
4443--
4544-- >>> stream = effect 1 `consM` effect 2 `consM` nil
4645-- >>> Stream.fold Fold.toList stream
@@ -60,8 +59,7 @@
6059--
6160-- >>> :{
6261-- echo =
63−-- Stream.repeat getLine -- Stream IO (IO String)
64−-- & Stream.sequence -- Stream IO String
62+-- Stream.repeatM getLine -- Stream IO String
6563-- & Stream.mapM putStrLn -- Stream IO ()
6664-- & Stream.fold Fold.drain -- IO ()
6765-- :}
@@ -75,10 +73,8 @@
7573-- "Data.List" like functions and many more powerful combinators to perform
7674-- common programming tasks.
7775--
78−-- Some common idioms:
76+-- == Useful Idioms
7977--
80−-- >>> repeatM = Stream.sequence . Stream.repeat
81−-- >>> replicateM n = Stream.sequence . Stream.replicate n
8278-- >>> fromListM = Stream.sequence . Stream.fromList
8379-- >>> fromFoldableM = Stream.sequence . Stream.fromFoldable
8480-- >>> fromIndices f = fmap f $ Stream.enumerateFrom 0