aboutsummaryrefslogtreecommitdiffhomepage
path: root/Pipes/Text/Tutorial.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Pipes/Text/Tutorial.hs')
-rw-r--r--Pipes/Text/Tutorial.hs6
1 files changed, 3 insertions, 3 deletions
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
84 in a way that is independent of the boundaries of the underlying @Text@ chunks. 84 in a way that is independent of the boundaries of the underlying @Text@ chunks.
85 This means that they may freely split text into smaller texts and /discard empty texts/. 85 This means that they may freely split text into smaller texts and /discard empty texts/.
86 The objective, though, is that they should not /concatenate texts/ in order to provide strict upper 86 The objective, though, is that they should not /concatenate texts/ in order to provide strict upper
87 bounds on memory usage. 87 bounds on memory usage even for indefinitely complex compositions.
88 88
89 For example, to stream only the first three lines of 'stdin' to 'stdout' you 89 For example, to stream only the first three lines of 'stdin' to 'stdout' you
90 might write: 90 might write:
@@ -93,12 +93,12 @@ import Pipes.Text.Encoding
93> import qualified Pipes.Text as Text 93> import qualified Pipes.Text as Text
94> import qualified Pipes.Text.IO as Text 94> import qualified Pipes.Text.IO as Text
95> import Pipes.Group (takes') 95> import Pipes.Group (takes')
96> import Lens.Family (view, (%~)) -- or, Control.Lens 96> import Lens.Family (view, over) -- or `Lens.Micro.Mtl` or `Control.Lens` or etc.
97> 97>
98> main = runEffect $ takeLines 3 Text.stdin >-> Text.stdout 98> main = runEffect $ takeLines 3 Text.stdin >-> Text.stdout
99> where 99> where
100> takeLines n = view Text.unlines . takes' n . view Text.lines 100> takeLines n = view Text.unlines . takes' n . view Text.lines
101> -- or equivalently: Text.unlines %~ takes' n 101> -- or equivalently: over Text.unlines (takes' n)
102 102
103 This program will not bring more into memory than what @Text.stdin@ considers 103 This program will not bring more into memory than what @Text.stdin@ considers
104 one chunk of text (~ 32 KB), even if individual lines are split 104 one chunk of text (~ 32 KB), even if individual lines are split