import Text.Parsec csvStruct = endBy line eol line = sepBy cell $ char ',' cell = many $ noneOf ",\n" eol = char '\n' parseCSV :: String -> Either ParseError [[String]] parseCSV src = parse csvStruct "* ParseError *" src % ghci ParseCSV.hs *Main> parseCSV "aa,bb,cc\n" Right [["aa","bb","cc"]] *Main> parseCSV "a,b,c\nd,e,x\n" Right [["a","b","c"],["d","e","x"]] *Main> parseCSV "invalid,a,b" Left "*
{{#tags}}- {{label}}
{{/tags}}