diff options
author | michaelt <what_is_it_to_do_anything@yahoo.com> | 2016-05-30 07:58:54 -0400 |
---|---|---|
committer | michaelt <what_is_it_to_do_anything@yahoo.com> | 2016-05-30 07:58:54 -0400 |
commit | 5dca0cf23401438e53f88a216b65d5e983bc9292 (patch) | |
tree | ef900f501df3fb78c669109e174f3f0cbf770ee1 /Pipes/Text | |
parent | d19efff3b167122a83f5c269fd6ecb8cf9c78f33 (diff) | |
download | text-pipes-5dca0cf23401438e53f88a216b65d5e983bc9292.tar.gz text-pipes-5dca0cf23401438e53f88a216b65d5e983bc9292.tar.zst text-pipes-5dca0cf23401438e53f88a216b65d5e983bc9292.zip |
pre-version-bump
Diffstat (limited to 'Pipes/Text')
-rw-r--r-- | Pipes/Text/Tutorial.hs | 6 |
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 |