From 5dca0cf23401438e53f88a216b65d5e983bc9292 Mon Sep 17 00:00:00 2001 From: michaelt Date: Mon, 30 May 2016 07:58:54 -0400 Subject: pre-version-bump --- Pipes/Text/Tutorial.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Pipes/Text') diff --git a/Pipes/Text/Tutorial.hs b/Pipes/Text/Tutorial.hs index eeaafa7..d7ff703 100644 --- a/Pipes/Text/Tutorial.hs +++ b/Pipes/Text/Tutorial.hs @@ -84,7 +84,7 @@ import Pipes.Text.Encoding in a way that is independent of the boundaries of the underlying @Text@ chunks. This means that they may freely split text into smaller texts and /discard empty texts/. The objective, though, is that they should not /concatenate texts/ in order to provide strict upper - bounds on memory usage. + bounds on memory usage even for indefinitely complex compositions. For example, to stream only the first three lines of 'stdin' to 'stdout' you might write: @@ -93,12 +93,12 @@ import Pipes.Text.Encoding > import qualified Pipes.Text as Text > import qualified Pipes.Text.IO as Text > import Pipes.Group (takes') -> import Lens.Family (view, (%~)) -- or, Control.Lens +> import Lens.Family (view, over) -- or `Lens.Micro.Mtl` or `Control.Lens` or etc. > > main = runEffect $ takeLines 3 Text.stdin >-> Text.stdout > where > takeLines n = view Text.unlines . takes' n . view Text.lines -> -- or equivalently: Text.unlines %~ takes' n +> -- or equivalently: over Text.unlines (takes' n) This program will not bring more into memory than what @Text.stdin@ considers one chunk of text (~ 32 KB), even if individual lines are split -- cgit v1.2.3