aboutsummaryrefslogtreecommitdiffhomepage
path: root/Pipes
diff options
context:
space:
mode:
Diffstat (limited to 'Pipes')
-rw-r--r--Pipes/Prelude/Text.hs9
1 files changed, 5 insertions, 4 deletions
diff --git a/Pipes/Prelude/Text.hs b/Pipes/Prelude/Text.hs
index 29ade4d..814da0a 100644
--- a/Pipes/Prelude/Text.hs
+++ b/Pipes/Prelude/Text.hs
@@ -54,12 +54,13 @@ TWO
54THREE 54THREE
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 separate line with @Pipes.Prelude.map ()* , as is frequently reasonable. Here we admit 58 as is frequently reasonable. Here we run
59 three values from standard input that pass the standard attoparsec @scientific@ number parser, 59 the simple attoparsec @scientific@ number parser on lines of standard input,
60 dropping bad parses with @P.concat@: 60 dropping bad parses with @P.concat@:
61 61
62>>> P.toListM $ stdinLn >-> P.map (A.parseOnly A.scientific) >-> P.concat >-> P.take 3 62>>> import qualified Data.Attoparsec.Text as A
63>>> P.toListM $ Text.stdinLn >-> P.map (A.parseOnly A.scientific) >-> P.concat >-> P.take 3
631<Enter> 641<Enter>
642<Enter> 652<Enter>
65bad<Enter> 66bad<Enter>