-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A flexible, fast, conduit-based CSV parser library for Haskell. -- -- CSV files are the de-facto standard in many situations involving data -- transfer, particularly when dealing with enterprise application or -- disparate database systems. -- -- While there are a number of CSV libraries in Haskell, at the time of -- this project's start in 2010, there wasn't one that provided all of -- the following: -- --
-- test :: IO () -- test = runResourceT $ -- sourceFile test/BigFile.csv $= -- decode utf8 $= -- intoCSV defCSVSettings $= -- myMapRowProcessingConduit $= -- fromCSV defCSVSettings $= -- encode utf8 $$ -- sinkFile test/BigFileOut.csv --class CSVeable s r rowToStr :: CSVeable s r => CSVSettings -> r -> s intoCSV :: (CSVeable s r, MonadResource m) => CSVSettings -> Conduit s m r fromCSV :: (CSVeable s r, MonadResource m) => CSVSettings -> Conduit r m s -- | Settings for a CSV file. This library is intended to be flexible and -- offer a way to process the majority of text data files out there. data CSVSettings CSVS :: !Char -> !Maybe Char -> !Maybe Char -> !Char -> CSVSettings -- | Separator character to be used in between fields csvSep :: CSVSettings -> !Char -- | Quote character that may sometimes be present around fields. If -- Nothing is given, the library will never expect quotation even -- if it is present. csvQuoteChar :: CSVSettings -> !Maybe Char -- | Quote character that should be used in the output. csvOutputQuoteChar :: CSVSettings -> !Maybe Char -- | Field separator that should be used in the output. csvOutputColSep :: CSVSettings -> !Char -- | Default settings for a CSV file. -- --
-- csvSep = ',' -- csvQuoteChar = Just '"' -- csvOutputQuoteChar = Just '"' -- csvOutputColSep = ',' --defCSVSettings :: CSVSettings -- | A MapRow is a dictionary based on Map type MapRow a = Map a a -- | A Row is just a list of fields type Row a = [a] -- | Read the entire contents of a CSV file into memory readCSVFile :: (MonadUnsafeIO m, MonadThrow m, MonadBaseControl IO m, MonadIO m, CSVeable ByteString a) => CSVSettings -> FilePath -> m [a] -- | Map over the rows of a CSV file. Don't be scared by the type -- signature, this can just run in IO. mapCSVFile :: (MonadIO m, MonadUnsafeIO m, MonadThrow m, MonadBaseControl IO m, CSVeable ByteString a, CSVeable ByteString b) => CSVSettings -> (a -> b) -> FilePath -> FilePath -> m () instance (CSVeable s (Row s'), Ord s', IsString s) => CSVeable s (MapRow s') instance CSVeable ByteString (Row Text) instance CSVeable Text (Row Text) instance CSVeable ByteString (Row ByteString)