aboutsummaryrefslogtreecommitdiffhomepage
path: root/Pipes/Prelude
diff options
context:
space:
mode:
Diffstat (limited to 'Pipes/Prelude')
-rw-r--r--Pipes/Prelude/Text.hs12
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
631<Enter>
642<Enter>
65bad<Enter>
663<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