cassava-conduit-0.2.0: Conduit interface for cassava package

Copyright(C) 2014
LicenseBSD-style (see the file etc/LICENSE.md)
MaintainerDom De Re
Safe HaskellNone
LanguageHaskell2010

Data.Csv.Conduit

Contents

Description

Conduit interface for cassava

Synopsis

Types

Conduits

fromCsv :: (FromRecord a, MonadError CsvParseError m) => DecodeOptions -> HasHeader -> Conduit ByteString m a Source

Streams parsed records, Errors are not received in the stream but instead after the pipeline is executed, If you want to handle errors as they come and resume, see fromCsvStreamError

fromCsvLiftError :: (FromRecord a, MonadError e m) => (CsvParseError -> e) -> DecodeOptions -> HasHeader -> Conduit ByteString m a Source

Sometimes your pipeline will involve an error type other than CsvParseError, in which case if you provide a function to project it into your custom error type, you can use this instead of fromCsv

fromNamedCsv :: (FromNamedRecord a, MonadError CsvParseError m) => DecodeOptions -> Conduit ByteString m a Source

Parses an instance of FromNamedRecord, this conduit drops the Header

Errors are not seen in the pipeline but rather at the end after executing the pipeline, if you want to handle the errors as they occur, try fromNamedCsvStreamError instead.

fromNamedCsvLiftError :: (FromNamedRecord a, MonadError e m) => (CsvParseError -> e) -> DecodeOptions -> Conduit ByteString m a Source

Sometimes your pipeline will involve an error type other than CsvParseError, in which case if you provide a function to project it into your custom error type, you can use this instead of fromCsv

fromCsvStreamError :: (Monad m, FromRecord a) => DecodeOptions -> HasHeader -> Conduit ByteString m (Either CsvParseError a) Source

Same as fromCsv but allows for errors to be handled in the pipeline instead

fromNamedCsvStreamError :: (Monad m, FromNamedRecord a) => DecodeOptions -> Conduit ByteString m (Either CsvParseError a) Source

Like fromNamedCsvStream but allows for errors to be handled in the pipeline itself.

toCsv :: (Monad m, ToRecord a) => EncodeOptions -> Conduit a m ByteString Source

Streams from csv to text, does not create headers...