@ ... , Parsec, , (, ), (, many1, , , , , " ", "", " " ).
, , , .
, , , , , String , String ( ) . " ", Parsec .
, , (, , ), , Parsec .
- , cell, String, , . Parsec CSV :
import Text.Parsec
import Text.Parsec.String
-- | `csv cell` parses a CSV file each of whose elements is parsed by `cell`
csv :: Parser a -> Parser [[a]]
csv cell = many (row cell)
-- | `row cell` parses a newline-terminated row of comma separated
-- `cell`-expressions
row :: Parser a -> Parser [a]
row cell = sepBy cell (char ',') <* char '\n'
, :
customCell :: Parser Int
customCell = read <$> many1 digit
CSV :
> parse (csv customCell) "" "1,2,3\n4,5,6\n"
Right [[1,2,3],[4,5,6]]
>
, cell, - , , "" , , , - .