Safe Haskell | Safe |
---|---|
Language | Haskell98 |
Regular matrix array data, CSV, column & row indexing.
- type CSV_Has_Header = Bool
- type CSV_Delimiter = Char
- type CSV_Allow_Linebreaks = Bool
- data CSV_Align_Columns
- type CSV_Opt = (CSV_Has_Header, CSV_Delimiter, CSV_Allow_Linebreaks, CSV_Align_Columns)
- def_csv_opt :: CSV_Opt
- type Table a = [[a]]
- type CSV_Table a = (Maybe [String], Table a)
- csv_table_read :: CSV_Opt -> (String -> a) -> FilePath -> IO (CSV_Table a)
- csv_table_read_def :: (String -> a) -> FilePath -> IO (Table a)
- csv_table_with :: CSV_Opt -> (String -> a) -> FilePath -> (CSV_Table a -> b) -> IO b
- csv_table_align :: CSV_Align_Columns -> Table String -> Table String
- csv_table_pp :: (a -> String) -> CSV_Opt -> CSV_Table a -> String
- csv_table_write :: (a -> String) -> CSV_Opt -> FilePath -> CSV_Table a -> IO ()
- csv_table_write_def :: (a -> String) -> FilePath -> Table a -> IO ()
- table_lookup :: Table a -> (Int, Int) -> a
- table_row :: Table a -> Row_Ref -> [a]
- table_column :: Table a -> Column_Ref -> [a]
- table_column_lookup :: Eq a => Table a -> (Column_Ref, Column_Ref) -> a -> Maybe a
- table_cell :: Table a -> Cell_Ref -> a
- table_lookup_row_segment :: Table a -> (Int, (Int, Int)) -> [a]
- table_row_segment :: Table a -> (Row_Ref, Column_Range) -> [a]
- table_to_array :: Table a -> Array Cell_Ref a
- csv_array_read :: CSV_Opt -> (String -> a) -> FilePath -> IO (Array Cell_Ref a)
- csv_field_str :: CSVField -> String
- csv_error_recover :: CSVError -> CSVRow
- csv_row_recover :: Either [CSVError] CSVRow -> CSVRow
- csv_load_irregular :: (String -> a) -> FilePath -> IO [[a]]
- type P5_Parser t1 t2 t3 t4 t5 = (String -> t1, String -> t2, String -> t3, String -> t4, String -> t5)
- type P5_Writer t1 t2 t3 t4 t5 = (t1 -> String, t2 -> String, t3 -> String, t4 -> String, t5 -> String)
- csv_table_read_p5 :: P5_Parser t1 t2 t3 t4 t5 -> CSV_Opt -> FilePath -> IO (Maybe [String], [(t1, t2, t3, t4, t5)])
- csv_table_write_p5 :: P5_Writer t1 t2 t3 t4 t5 -> CSV_Opt -> FilePath -> (Maybe [String], [(t1, t2, t3, t4, t5)]) -> IO ()
TABLE
type CSV_Has_Header = Bool Source #
When reading a CSV file is the first row a header?
type CSV_Delimiter = Char Source #
Alias for Char
, allow characters other than ,
as delimiter.
type CSV_Allow_Linebreaks = Bool Source #
Alias for Bool
, allow linebreaks in fields.
data CSV_Align_Columns Source #
When writing a CSV file should the delimiters be aligned, ie. should columns be padded with spaces, and if so at which side of the data?
type CSV_Opt = (CSV_Has_Header, CSV_Delimiter, CSV_Allow_Linebreaks, CSV_Align_Columns) Source #
CSV options.
def_csv_opt :: CSV_Opt Source #
Default CSV options, no header, comma delimiter, no linebreaks, no alignment.
Plain list representation of a two-dimensional table of a in row-order. Tables are regular, ie. all rows have equal numbers of columns.
csv_table_read :: CSV_Opt -> (String -> a) -> FilePath -> IO (CSV_Table a) Source #
Read CSV_Table
from CSV
file.
csv_table_read_def :: (String -> a) -> FilePath -> IO (Table a) Source #
Read Table
only with def_csv_opt
.
csv_table_with :: CSV_Opt -> (String -> a) -> FilePath -> (CSV_Table a -> b) -> IO b Source #
Read and process CSV
CSV_Table
.
csv_table_align :: CSV_Align_Columns -> Table String -> Table String Source #
Align table according to CSV_Align_Columns
.
csv_table_align CSV_No_Align [["a","row","and"],["then","another","one"]]
csv_table_write_def :: (a -> String) -> FilePath -> Table a -> IO () Source #
Write Table
only (no header) with def_csv_opt
.
table_column :: Table a -> Column_Ref -> [a] Source #
Column data.
table_column_lookup :: Eq a => Table a -> (Column_Ref, Column_Ref) -> a -> Maybe a Source #
Lookup value across columns.
table_cell :: Table a -> Cell_Ref -> a Source #
Table cell lookup.
table_lookup_row_segment :: Table a -> (Int, (Int, Int)) -> [a] Source #
0
-indexed (row,column) cell lookup over column range.
table_row_segment :: Table a -> (Row_Ref, Column_Range) -> [a] Source #
Range of cells from row.
Array
Irregular
csv_field_str :: CSVField -> String Source #
csv_error_recover :: CSVError -> CSVRow Source #
csv_load_irregular :: (String -> a) -> FilePath -> IO [[a]] Source #
Read irregular CSV
file, ie. rows may have any number of columns, including no columns.
Tuples
type P5_Parser t1 t2 t3 t4 t5 = (String -> t1, String -> t2, String -> t3, String -> t4, String -> t5) Source #
type P5_Writer t1 t2 t3 t4 t5 = (t1 -> String, t2 -> String, t3 -> String, t4 -> String, t5 -> String) Source #