blob: ddf770d0776f618c4c6aa8f1280d1c1ab34b0d7a (
plain) (
tree)
|
|
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))
|