diff options
author | michaelt <what_is_it_to_do_anything@yahoo.com> | 2016-02-06 23:20:25 -0500 |
---|---|---|
committer | michaelt <what_is_it_to_do_anything@yahoo.com> | 2016-02-06 23:20:25 -0500 |
commit | c3e06dbcca93dc0116a3f522fd514e95ec87d206 (patch) | |
tree | c607ac7cdcb43729dfad4e5a90d05e3d6eb19f17 /Pipes/Prelude | |
parent | 5cfcd4996cbc258ba67b20d700d349190e20cb6d (diff) | |
download | text-pipes-c3e06dbcca93dc0116a3f522fd514e95ec87d206.tar.gz text-pipes-c3e06dbcca93dc0116a3f522fd514e95ec87d206.tar.zst text-pipes-c3e06dbcca93dc0116a3f522fd514e95ec87d206.zip |
little attoparsec example repaired
Diffstat (limited to 'Pipes/Prelude')
-rw-r--r-- | Pipes/Prelude/Text.hs | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/Pipes/Prelude/Text.hs b/Pipes/Prelude/Text.hs index 814da0a..d573e51 100644 --- a/Pipes/Prelude/Text.hs +++ b/Pipes/Prelude/Text.hs | |||
@@ -28,14 +28,14 @@ import Pipes.Safe (MonadSafe(..), runSafeT, runSafeP) | |||
28 | import Prelude hiding (readFile, writeFile) | 28 | import Prelude hiding (readFile, writeFile) |
29 | 29 | ||
30 | {- $lineio | 30 | {- $lineio |
31 | Line-based operations are marked with a final \-@Ln@, like 'stdinLn', 'readFileLn', etc. They are | 31 | Line-based operations are marked with a final \-@Ln@, like 'stdinLn', 'readFileLn', etc. |
32 | drop-in replacements for the line-based operations in @Pipes.Prelude@ and | 32 | They are drop-in 'Text' replacements for the corresponding 'String' operations in |
33 | @Pipes.Safe.Prelude@ - the final \-@Ln@ being added where necessary. | 33 | @Pipes.Prelude@ and @Pipes.Safe.Prelude@ - a final \-@Ln@ being added where necessary. |
34 | With them, one is producing, piping and consuming semantically significant individual texts, | 34 | In using them, one is producing and consuming semantically significant individual texts, |
35 | understood as lines, just as one would produce or pipe 'Int's or 'Char's or anything else. | 35 | understood as lines, just as one would produce or pipe 'Int's or 'Char's or anything else. |
36 | Thus, the standard materials from @Pipes@ and @Pipes.Prelude@ and | 36 | Thus, the standard materials from @Pipes@ and @Pipes.Prelude@ and |
37 | @Data.Text@ are all you need to interact with these lines as you read or write them, and | 37 | @Data.Text@ are all you need to work with them, and |
38 | you can use these operations without using any of the other material in this package. | 38 | you can use these operations without using any of the other modules in this package. |
39 | 39 | ||
40 | Thus, to take a trivial case, here we upper-case three lines from standard input and write | 40 | Thus, to take a trivial case, here we upper-case three lines from standard input and write |
41 | them to a file. | 41 | them to a file. |
@@ -54,9 +54,9 @@ TWO | |||
54 | THREE | 54 | THREE |
55 | 55 | ||
56 | The point of view is very much that of @Pipes.Prelude@. It would still be the same even if | 56 | The point of view is very much that of @Pipes.Prelude@. It would still be the same even if |
57 | we did something more sophisticated, like run an ordinary attoparsec 'Text' parser on, | 57 | we did something a bit more sophisticated, like run an ordinary attoparsec 'Text' parser on |
58 | as is frequently reasonable. Here we run | 58 | each line, as is frequently desirable. Here we run |
59 | the simple attoparsec @scientific@ number parser on lines of standard input, | 59 | a minimal attoparsec number parser, @scientific@, on separate lines of standard input, |
60 | dropping bad parses with @P.concat@: | 60 | dropping bad parses with @P.concat@: |
61 | 61 | ||
62 | >>> import qualified Data.Attoparsec.Text as A | 62 | >>> import qualified Data.Attoparsec.Text as A |
@@ -94,7 +94,7 @@ stdinLn = fromHandleLn IO.stdin | |||
94 | {-# INLINABLE stdinLn #-} | 94 | {-# INLINABLE stdinLn #-} |
95 | 95 | ||
96 | 96 | ||
97 | {-| Write 'String's to 'IO.stdout' using 'putStrLn' | 97 | {-| Write 'Text' lines to 'IO.stdout' using 'putStrLn' |
98 | 98 | ||
99 | Unlike 'toHandle', 'stdoutLn' gracefully terminates on a broken output pipe | 99 | Unlike 'toHandle', 'stdoutLn' gracefully terminates on a broken output pipe |
100 | -} | 100 | -} |
@@ -113,7 +113,7 @@ stdoutLn = go | |||
113 | Right () -> go | 113 | Right () -> go |
114 | {-# INLINABLE stdoutLn #-} | 114 | {-# INLINABLE stdoutLn #-} |
115 | 115 | ||
116 | {-| Write lines of 'Text's to 'IO.stdout'. | 116 | {-| Write lines of 'Text' to 'IO.stdout'. |
117 | 117 | ||
118 | This does not handle a broken output pipe, but has a polymorphic return | 118 | This does not handle a broken output pipe, but has a polymorphic return |
119 | value. | 119 | value. |