readcsv 0.1 → 0.1.1
raw patch · 2 files changed
+10/−2 lines, 2 files
Files
- readcsv.cabal +1/−1
- src/Text/Read/CSV.hs +9/−1
readcsv.cabal view
@@ -1,5 +1,5 @@ name: readcsv-version: 0.1+version: 0.1.1 synopsis: Lightweight CSV parser/emitter based on ReadP description: Parses and emits tables of strings formatted according to RFC 4180, /"The common Format and MIME Type for Comma-Separated Values (CSV) Files"/.
src/Text/Read/CSV.hs view
@@ -22,6 +22,14 @@ import Data.List import Data.Maybe +munchSpaces :: ReadP ()+munchSpaces =+ do s <- look+ skip s+ where+ skip (' ':s) = get >> skip s+ skip _ = return ()+ unescaped :: ReadP String unescaped = munch (`notElem` ",\"\r\n\t") @@ -39,7 +47,7 @@ fullquoted = fmap (intercalate "\"") (many1 singlequoted) csvcell :: ReadP String-csvcell = skipSpaces >> (unescaped +++ fullquoted)+csvcell = munchSpaces >> (unescaped +++ fullquoted) csvrow :: ReadP [String] csvrow = sepBy1 csvcell (char ',')