diff options
author | michaelt <what_is_it_to_do_anything@yahoo.com> | 2016-02-06 17:47:51 -0500 |
---|---|---|
committer | michaelt <what_is_it_to_do_anything@yahoo.com> | 2016-02-06 17:47:51 -0500 |
commit | cca039badec3240c72a6b773802f3a17aceda001 (patch) | |
tree | 56b8f23e9c79d4740b78b47b07601a3f1b352be0 /Pipes | |
parent | f328ae9eff47540e4dffb9c932c67ea55491726e (diff) | |
download | text-pipes-cca039badec3240c72a6b773802f3a17aceda001.tar.gz text-pipes-cca039badec3240c72a6b773802f3a17aceda001.tar.zst text-pipes-cca039badec3240c72a6b773802f3a17aceda001.zip |
remarks in pipes-prelude-text
Diffstat (limited to 'Pipes')
-rw-r--r-- | Pipes/Prelude/Text.hs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/Pipes/Prelude/Text.hs b/Pipes/Prelude/Text.hs index be5b502..29ade4d 100644 --- a/Pipes/Prelude/Text.hs +++ b/Pipes/Prelude/Text.hs | |||
@@ -55,7 +55,17 @@ 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 more sophisticated, like run an ordinary attoparsec 'Text' parser on |
58 | each line, as if frequently reasonable. | 58 | each separate line with @Pipes.Prelude.map ()* , as is frequently reasonable. Here we admit |
59 | three values from standard input that pass the standard attoparsec @scientific@ number parser, | ||
60 | dropping bad parses with @P.concat@: | ||
61 | |||
62 | >>> P.toListM $ stdinLn >-> P.map (A.parseOnly A.scientific) >-> P.concat >-> P.take 3 | ||
63 | 1<Enter> | ||
64 | 2<Enter> | ||
65 | bad<Enter> | ||
66 | 3<Enter> | ||
67 | [1.0,2.0,3.0] | ||
68 | |||
59 | 69 | ||
60 | The line-based operations are, however, subject to a number of caveats. | 70 | The line-based operations are, however, subject to a number of caveats. |
61 | First, where they read from a handle, they will of course happily | 71 | First, where they read from a handle, they will of course happily |