@@ -182,6 +182,7 @@ import Control.Monad.Trans.Class (MonadTrans (lift))
182182--
183183-- @
184184-- import "Streamly"
185+-- import "Streamly.Prelude"
185186--
186187-- main = do
187188-- xs \<- 'toList' $ 'serially' $ return 1 <> return 2
@@ -369,6 +370,7 @@ import Control.Monad.Trans.Class (MonadTrans (lift))
369370--
370371-- @
371372-- import "Streamly"
373+-- import "Streamly.Prelude"
372374--
373375-- main = do
374376-- 'toList' . 'serially' $ 'foldWith' (<>) (map return [1..10]) >>= print
@@ -408,6 +410,9 @@ import Control.Monad.Trans.Class (MonadTrans (lift))
408410-- list transformer like serial composition.
409411--
410412-- @
413+-- import "Streamly"
414+-- import "Streamly.Prelude"
415+--
411416-- main = 'runStreamT' $ do
412417-- x <- 'each' [3,2,1]
413418-- delay x
@@ -423,12 +428,25 @@ import Control.Monad.Trans.Class (MonadTrans (lift))
423428-- same thread one after another. When compared to imperative programming, this
424429-- can also be viewed as a @for@ loop with three iterations.
425430--
431+-- A console echo loop copying standard input to standard output can simply be
432+-- written like this:
433+--
434+-- @
435+-- import "Streamly"
436+-- import Data.Semigroup (cycle1)
437+--
438+-- main = 'runStreamT' $ cycle1 (liftIO getLine) >>= liftIO . putStrLn
439+-- @
440+--
426441-- When multiple streams are composed using this style they nest in a DFS
427442-- manner i.e. nested iterations of an iteration are executed before we proceed
428443-- to the next iteration at higher level. This behaves just like nested @for@
429444-- loops in imperative programming.
430445--
431446-- @
447+-- import "Streamly"
448+-- import "Streamly.Prelude"
449+--
432450-- main = 'runStreamT' $ do
433451-- x <- 'each' [1,2]
434452-- y <- 'each' [3,4]
@@ -454,6 +472,9 @@ import Control.Monad.Trans.Class (MonadTrans (lift))
454472-- This is the concurrent version of 'StreamT'.
455473--
456474-- @
475+-- import "Streamly"
476+-- import "Streamly.Prelude"
477+--
457478-- main = 'runAsyncT' $ do
458479-- x <- 'each' [3,2,1]
459480-- delay x
@@ -478,6 +499,9 @@ import Control.Monad.Trans.Class (MonadTrans (lift))
478499-- demand from the consumer.
479500--
480501-- @
502+-- import "Streamly"
503+-- import "Streamly.Prelude"
504+--
481505-- main = 'runAsyncT' $ do
482506-- x <- 'each' [1,2]
483507-- y <- 'each' [3,4]
@@ -501,6 +525,9 @@ import Control.Monad.Trans.Class (MonadTrans (lift))
501525-- the continuations or iterations of the inner loop.
502526--
503527-- @
528+-- import "Streamly"
529+-- import "Streamly.Prelude"
530+--
504531-- main = 'runInterleavedT' $ do
505532-- x <- 'each' [1,2]
506533-- y <- 'each' [3,4]
@@ -524,6 +551,9 @@ import Control.Monad.Trans.Class (MonadTrans (lift))
524551-- concurrently instead of the demand driven concurrency of 'AsyncT'.
525552--
526553-- @
554+-- import "Streamly"
555+-- import "Streamly.Prelude"
556+--
527557-- main = 'runParallelT' $ do
528558-- x <- 'each' [3,2,1]
529559-- delay x
@@ -546,6 +576,8 @@ import Control.Monad.Trans.Class (MonadTrans (lift))
546576--
547577-- @
548578-- import "Streamly"
579+-- import "Streamly.Prelude"
580+--
549581--
550582-- composed :: 'Streaming' t => t m a
551583-- composed = do
@@ -889,8 +921,8 @@ import Control.Monad.Trans.Class (MonadTrans (lift))
889921-- demonstrated below.
890922--
891923-- @
892−-- import Streamly
893−-- import Streamly.Prelude
924+-- import "Streamly"
925+-- import "Streamly.Prelude"
894926-- import System.IO (stdin)
895927--
896928-- -- Adapt uncons to return an Either instead of Maybe
@@ -911,7 +943,7 @@ import Control.Monad.Trans.Class (MonadTrans (lift))
911943-- -- pipe to streamly
912944-- -- Adapt P.next to return a Maybe instead of Either
913945-- let nextM p = P.next p >>= either (\\_ -> return Nothing) (return . Just)
914−-- runStreamT $ unfoldrM nextM P.stdinLn >>= lift . putStrLn
946+-- 'runStreamT' $ 'unfoldrM' nextM P.stdinLn >>= lift . putStrLn
915947-- @
916948--
917949-- Interop with @streaming@:
@@ -925,7 +957,7 @@ import Control.Monad.Trans.Class (MonadTrans (lift))
925957-- S.stdoutLn $ S.unfoldr unconsE stdinLn
926958--
927959-- -- streaming to streamly
928−-- runStreamT $ unfoldrM S.uncons S.stdinLn >>= lift . putStrLn
960+-- 'runStreamT' $ unfoldrM S.uncons S.stdinLn >>= lift . putStrLn
929961--
930962-- @
931963--