From: michaelt Date: Sat, 6 Feb 2016 22:47:51 +0000 (-0500) Subject: remarks in pipes-prelude-text X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=cca039badec3240c72a6b773802f3a17aceda001;p=github%2Ffretlink%2Ftext-pipes.git remarks in pipes-prelude-text --- 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 The point of view is very much that of @Pipes.Prelude@. It would still be the same even if we did something more sophisticated, like run an ordinary attoparsec 'Text' parser on - each line, as if frequently reasonable. + each separate line with @Pipes.Prelude.map ()* , as is frequently reasonable. Here we admit + three values from standard input that pass the standard attoparsec @scientific@ number parser, + dropping bad parses with @P.concat@: + +>>> P.toListM $ stdinLn >-> P.map (A.parseOnly A.scientific) >-> P.concat >-> P.take 3 +1 +2 +bad +3 +[1.0,2.0,3.0] + The line-based operations are, however, subject to a number of caveats. First, where they read from a handle, they will of course happily