drasil-data-formats-0.0.1: A framework for code and document generation for scientific software
Safe HaskellSafe-Inferred
LanguageHaskell2010

Drasil.Data.Formats.CSV.Core

Synopsis

CSVs

data CSV Source #

A CSV file representation containing an optional header and a list of rows.

Caches the column and row counts for future potential reference.

Instances

Instances details
Show CSV Source # 
Instance details

Defined in Drasil.Data.Formats.CSV.Core

Methods

showsPrec :: Int -> CSV -> ShowS #

show :: CSV -> String #

showList :: [CSV] -> ShowS #

Eq CSV Source # 
Instance details

Defined in Drasil.Data.Formats.CSV.Core

Methods

(==) :: CSV -> CSV -> Bool #

(/=) :: CSV -> CSV -> Bool #

type ColumnCount = Natural Source #

The number of columns a CSV has.

type RowCount = Natural Source #

The number of rows a CSV has (excluding its reader).

header :: CSV -> Maybe [Text] Source #

Get the header row of a CSV.

rows :: CSV -> [[Text]] Source #

Get all rows of a CSV (excludes header).

columnCount :: CSV -> ColumnCount Source #

Get the number of columns in a CSV.

rowCount :: CSV -> RowCount Source #

Get the number of rows in a CSV (excludes header).

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.