-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Conduit interface for cassava package
--   
--   Conduit interface for cassava package
--   
--   PRs welcome.
@package cassava-conduit
@version 0.5.0


-- | Conduit interface for cassava
module Data.Csv.Conduit
data CsvParseError
CsvParseError :: ByteString -> Text -> CsvParseError
IncrementalError :: Text -> CsvParseError

-- | When you want to include errors in the stream, this error type
--   represents errors that halt the stream. They do not appear inside the
--   conduit and will instead get returned from running the conduit.
data CsvStreamHaltParseError

-- | the remaining bytestring that was read in but not parsed yet, and the
--   stringy error msg describing the fail.
HaltingCsvParseError :: ByteString -> Text -> CsvStreamHaltParseError

-- | When you want to include errors in the stream, these are the errors
--   that can be included in the stream, they are usually problems
--   restricted to individual records, and streaming can resume from the
--   next record you just have to decide on something sensible to do with
--   the per record errors.
data CsvStreamRecordParseError

-- | The stringy error describing why this record could not be parsed.
CsvStreamRecordParseError :: Text -> CsvStreamRecordParseError

-- | 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 <a>fromCsvStreamError</a>
fromCsv :: (FromRecord a, MonadError CsvParseError m) => DecodeOptions -> HasHeader -> ConduitT ByteString a m ()

-- | Sometimes your pipeline will involve an error type other than
--   <a>CsvParseError</a>, in which case if you provide a function to
--   project it into your custom error type, you can use this instead of
--   <a>fromCsv</a>
fromCsvLiftError :: (FromRecord a, MonadError e m) => (CsvParseError -> e) -> DecodeOptions -> HasHeader -> ConduitT ByteString a m ()

-- | Parses an instance of <a>FromNamedRecord</a>, 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 <a>fromNamedCsvStreamError</a> instead.
fromNamedCsv :: (FromNamedRecord a, MonadError CsvParseError m) => DecodeOptions -> ConduitT ByteString a m ()

-- | Sometimes your pipeline will involve an error type other than
--   <a>CsvParseError</a>, in which case if you provide a function to
--   project it into your custom error type, you can use this instead of
--   <a>fromCsv</a>
fromNamedCsvLiftError :: (FromNamedRecord a, MonadError e m) => (CsvParseError -> e) -> DecodeOptions -> ConduitT ByteString a m ()

-- | Same as <a>fromCsv</a> but allows for errors to be handled in the
--   pipeline instead
fromCsvStreamError :: (FromRecord a, MonadError e m) => DecodeOptions -> HasHeader -> (CsvStreamHaltParseError -> e) -> ConduitT ByteString (Either CsvStreamRecordParseError a) m ()

-- | Like <tt>fromNamedCsvStream</tt> but allows for errors to be handled
--   in the pipeline itself.
fromNamedCsvStreamError :: (FromNamedRecord a, MonadError e m) => DecodeOptions -> (CsvStreamHaltParseError -> e) -> ConduitT ByteString (Either CsvStreamRecordParseError a) m ()

-- | Streams from csv to text, does not create headers...
toCsv :: (Monad m, ToRecord a) => EncodeOptions -> ConduitT a ByteString m ()
instance GHC.Classes.Eq Data.Csv.Conduit.CsvStreamRecordParseError
instance GHC.Show.Show Data.Csv.Conduit.CsvStreamRecordParseError
instance GHC.Classes.Eq Data.Csv.Conduit.CsvStreamHaltParseError
instance GHC.Show.Show Data.Csv.Conduit.CsvStreamHaltParseError
instance GHC.Classes.Eq Data.Csv.Conduit.CsvParseError
instance GHC.Show.Show Data.Csv.Conduit.CsvParseError
