[Pkg-haskell-commits] [SCM] haskell-testpack branch, master, updated. debian/1.0.2-1-4-gb0d6b36
gwern0
gwern0 at gmail.com
Fri Apr 23 15:22:12 UTC 2010
The following commit has been merged in the master branch:
commit 0aaed57cff0d684d3d74b0e0b52401551e1df3b8
Author: gwern0 <gwern0 at gmail.com>
Date: Fri Nov 30 12:27:33 2007 +0100
-Wall - +types for Data.CSV
diff --git a/src/Data/CSV.hs b/src/Data/CSV.hs
index 3972cbc..a040d38 100644
--- a/src/Data/CSV.hs
+++ b/src/Data/CSV.hs
@@ -30,14 +30,19 @@ Haskell Parsec parsers for comma-separated value (CSV) files.
Written by John Goerzen, jgoerzen\@complete.org
-}
-module Data.CSV(csvFile, genCsvFile) where
+module Data.CSV (csvFile, genCsvFile) where
import Text.ParserCombinators.Parsec
-import Data.List
+import Data.List (intersperse)
+eol :: forall st. GenParser Char st String
eol = (try $ string "\n\r") <|> (try $ string "\r\n") <|> string "\n" <|>
string "\r" <?> "End of line"
+
+cell :: GenParser Char st String
cell = quotedcell <|> many (noneOf ",\n\r")
-quotedchar = noneOf "\""
+
+quotedchar :: GenParser Char st Char
+quotedchar = noneOf "\""
<|> (try $ do string "\"\""
return '"'
)
@@ -46,6 +51,8 @@ quotedcell = do char '"'
content <- many quotedchar
char '"'
return content
+
+line :: GenParser Char st [String]
line = sepBy cell (char ',')
{- | Parse a Comma-Separated Value (CSV) file. The return value is a list of
--
haskell-testpack
More information about the Pkg-haskell-commits
mailing list