| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Drasil.Data.Formats.CSV
Contents
Synopsis
- data CSV
- type ColumnCount = Natural
- type RowCount = Natural
- header :: CSV -> Maybe [Text]
- rows :: CSV -> [[Text]]
- columnCount :: CSV -> ColumnCount
- rowCount :: CSV -> RowCount
- mkCSV :: Maybe ColumnCount -> Maybe [Text] -> [[Text]] -> Either String CSV
- data CSVRenderOptions
- data DoubleQuotationPolicy
- csvRenderOpts :: DoubleQuotationPolicy -> CSVRenderOptions
- renderCSV :: CSVRenderOptions -> CSV -> Doc ann
CSVs
A CSV file representation containing an optional header and a list of rows.
Caches the column and row counts for future potential reference.
type ColumnCount = Natural Source #
The number of columns a CSV has.
columnCount :: CSV -> ColumnCount Source #
Get the number of columns in a CSV.
Constructors
mkCSV :: Maybe ColumnCount -> Maybe [Text] -> [[Text]] -> Either String CSV Source #
Create a CSV. Expects all rows and the header to have the same length. If
the expected column count is not provided (the first parameter), then the
number of columns in the header is used as the expected column count. If the
header does not exist, the length of the first row is used. If the data is
also empty, you will have an empty CSV with no columns and no rows.
Rendering
data CSVRenderOptions Source #
Options for rendering a CSV.
data DoubleQuotationPolicy Source #
Cell-wrapping policy: How often should cells be wrapped in double quotes?
Constructors
| Minimal | Only when necessary, i.e., a cell contains either double quotes, a comma, CR, LF, or CRLF. |
| Everywhere | Everywhere. |