Safe Haskell | None |
---|
This module allows for streaming decoding of CSV data. This is useful if you need to parse large amounts of input in constant space. The API also allows you to ignore type conversion errors on a per-record basis.
- data Records a
- decode :: FromRecord a => Bool -> ByteString -> Records a
- decodeWith :: FromRecord a => DecodeOptions -> Bool -> ByteString -> Records a
- decodeByName :: FromNamedRecord a => ByteString -> Either String (Header, Records a)
- decodeByNameWith :: FromNamedRecord a => DecodeOptions -> ByteString -> Either String (Header, Records a)
Documentation
A stream of parsed records. If type conversion failed for the
record, the error is returned as
.
Left
errMsg
:: FromRecord a | |
=> Bool | Data contains header that should be skipped |
-> ByteString | CSV data |
-> Records a |
Efficiently deserialize CSV records in a streaming fashion.
Equivalent to
.
decodeWith
defaultDecodeOptions
:: FromRecord a | |
=> DecodeOptions | Decoding options |
-> Bool | Data contains header that should be skipped |
-> ByteString | CSV data |
-> Records a |
Like decode
, but lets you customize how the CSV data is parsed.
:: FromNamedRecord a | |
=> ByteString | CSV data |
-> Either String (Header, Records a) |
Efficiently deserialize CSV in a streaming fashion. The data is
assumed to be preceeded by a header. Returns
if
parsing the header fails. Equivalent to Left
errMsg
.
decodeByNameWith
defaultDecodeOptions
:: FromNamedRecord a | |
=> DecodeOptions | Decoding options |
-> ByteString | CSV data |
-> Either String (Header, Records a) |
Like decodeByName
, but lets you customize how the CSV data is
parsed.