2 import Pipes.Text.IO (fromHandle)
3 import Pipes.Attoparsec (parsed)
4 import qualified System.IO as IO
5 import Data.Attoparsec.Text
6 import Control.Applicative
12 testParser :: Parser Test
20 main = IO.withFile "./testfile" IO.ReadMode $ \handle -> runEffect $
21 do leftover <- for (parsed testParser (fromHandle handle))
23 return () -- ignore unparsed material
25 -- >>> :! cat testfile
38 -- Test {a = 1, b = 1}
39 -- Test {a = 2, b = 2}
40 -- Test {a = 3, b = 3}
41 -- Test {a = 4, b = 4}
42 -- Test {a = 5, b = 5}
43 -- Test {a = 6, b = 6}
44 -- Test {a = 7, b = 7}
45 -- Test {a = 8, b = 8}
46 -- Test {a = 9, b = 9}
47 -- Test {a = 10, b = 10}