Portability | |
---|---|
Stability | provisional |
Maintainer | Don Stewart <dons@galois.com> |
Safe Haskell | Safe-Infered |
- type CSV = [Record]
- type Record = [Field]
- type Field = ByteString
- parseCSV :: ByteString -> Maybe CSV
Documentation
A CSV file is a series of records. According to the RFC, the records all have to have the same length. As an extension, I allow variable length records.
A record is a series of fields Each record is located on a separate line, delimited by a line break (CRLF).
type Field = ByteStringSource
A field is a strict ByteString. Within the header and each record, there may be one or more ields, separated by commas. Each line should contain the same number of fields throughout the file. Spaces are considered part of a field and should not be ignored. The last field in the record must not be followed by a comma.
parseCSV :: ByteString -> Maybe CSVSource
Parse a ByteString into a CSV form.