blob: ddf770d0776f618c4c6aa8f1280d1c1ab34b0d7a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
import Pipes
import Pipes.Text.IO (fromHandle)
import Pipes.Attoparsec (parsed)
import qualified System.IO as IO
data Test = Test {
a :: Int,
b :: Int
} deriving (Show)
testParser :: Parser Test
testParser = do
a <- decimal
space
b <- decimal
endOfLine
return $ Test a b
main = IO.withFile "./testfile" IO.ReadMode $ \handle -> runEffect $
for test_parser (lift . print)
where (parsed (testParser <* endOfLine) (fromHandle handle))
|