This code works only when numerals (eg: "1243\t343\n"
) are present:
tabFile = endBy line eol
line = sepBy cell (many1 tab)
cell = integer
eol = char '\n'
integer = rd <$> many digit
where rd = read :: String -> Int
Is there a way to make it parse "abcd\tefg\n1243\t343\n"
such that it ignores the "abcd\tefg\n"
part ?
You can skip everything except digits using skipMany. Something like the next:
many (skipMany (noneOf ['0'..'9']) >> digit)
or (depending on what you actually need)
skipMany (noneOf ['0'..'9']) >> many digit