CSV
CSV
This is a CSV parser which follows RFC4180
For simplicity's sake, the following things are not yet supported:
- CSV files with headings
The following however is supported
- A simple LF ("\n") instead of CRLF ("\r\n") to separate records.
CSVRecord
parseStr : Parser CSVRecord a, Str -> Result (List a) [ ParsingFailure Str, SyntaxError Str, ParsingIncomplete CSVRecord ]
Attempts to Parser.parse an a
from a Str
that is encoded in CSV format.
parseCSV : Parser CSVRecord a, CSV -> Result (List a) [ ParsingFailure Str, ParsingIncomplete CSVRecord ]
Attempts to Parser.parse an a
from a CSV
datastructure (a list of lists of bytestring-fields).
record : a -> Parser CSVRecord a
Wrapper function to combine a set of fields into your desired a
record (\firstName -> \lastName -> \age -> User {firstName, lastName, age}) |> field string |> field string |> field u64
field : Parser String.Utf8 a -> Parser CSVRecord a
Turns a parser for a List U8
into a parser that parses part of a CSVRecord
.
string : Parser CSVField Str
Parser for a field containing a UTF8-encoded string
u64 : Parser CSVField U64
Parse a number from a CSV field
f64 : Parser CSVField F64
Parse a 64-bit float from a CSV field
parseStrToCSVRecord : Str -> Result CSVRecord [ ParsingFailure Str, ParsingIncomplete String.Utf8 ]
Attempts to Parser.parse a Str into the internal CSVRecord
datastructure (A list of bytestring-fields).