Compare commits
No commits in common. "886f991ee3a91d1a7728286ad174686351968fd1" and "d27eb919526bc99ffb8bb025ccb41ba0aa15e939" have entirely different histories.
886f991ee3
...
d27eb91952
@ -35,20 +35,15 @@ module Data.CSV.Sip (
|
||||
-- ** Write an entire CSV file
|
||||
writeCSV,
|
||||
writeRawCSV,
|
||||
writeCSVFromStream,
|
||||
writeRawCSVFromStream,
|
||||
-- * Conduits
|
||||
-- ** Producers
|
||||
readFromCSV,
|
||||
readFromCSVRaw,
|
||||
-- ** Encoding
|
||||
encodeCSV,
|
||||
encodeRawCSV,
|
||||
-- ** Consumers
|
||||
writeToCSV,
|
||||
writeToCSVRaw,
|
||||
-- ** Transformers
|
||||
-- *** Encoding
|
||||
encodeRows,
|
||||
encodeRawRows,
|
||||
-- *** Decoding
|
||||
-- ** Decoding
|
||||
labelFields,
|
||||
decodeRows,
|
||||
decodeRawRows,
|
||||
@ -132,21 +127,27 @@ writeRawCSV
|
||||
-> m ()
|
||||
writeRawCSV file csv = runConduit $ encodeRawCSV csv .| sinkFile file
|
||||
|
||||
-- | reads a stream of Text-based rows from a CSV file
|
||||
readFromCSV
|
||||
-- | Write a CSV file from a stream of Text-based rows
|
||||
writeCSVFromStream
|
||||
:: MonadResource m
|
||||
=> FilePath
|
||||
-- ^ the path to the CSV file to read from
|
||||
-> ConduitT i [T.Text] m ()
|
||||
readFromCSV file = sourceFile file .| decodeRows
|
||||
-- ^ the path to the file to write to
|
||||
-> ConduitT () [T.Text] m ()
|
||||
-- ^ the source conduit
|
||||
-> m ()
|
||||
writeCSVFromStream file src = runConduit $
|
||||
src .| encodeRows .| sinkFile file
|
||||
|
||||
-- | reads a stream of ByteString-based rows from a CSV file
|
||||
readFromCSVRaw
|
||||
-- | Write a CSV file from a stream of ByteString-based rows
|
||||
writeRawCSVFromStream
|
||||
:: MonadResource m
|
||||
=> FilePath
|
||||
-- ^ the path to the CSV file to read from
|
||||
-> ConduitT i [BS.ByteString] m ()
|
||||
readFromCSVRaw file = sourceFile file .| decodeRawRows
|
||||
-- ^ the path to the file to write to
|
||||
-> ConduitT () [BS.ByteString] m ()
|
||||
-- ^ the source conduit
|
||||
-> m ()
|
||||
writeRawCSVFromStream file src = runConduit $
|
||||
src .| encodeRawRows .| sinkFile file
|
||||
|
||||
-- | encode an entire CSV file
|
||||
encodeCSV
|
||||
@ -164,22 +165,6 @@ encodeRawCSV
|
||||
-> ConduitT () BS.ByteString m ()
|
||||
encodeRawCSV csv = sourceList csv .| encodeRawRows
|
||||
|
||||
-- | Writes a stream of Text-based rows to a CSV file
|
||||
writeToCSV
|
||||
:: MonadResource m
|
||||
=> FilePath
|
||||
-- ^ the path to the CSV file to write to
|
||||
-> ConduitT [T.Text] o m ()
|
||||
writeToCSV file = encodeRows .| sinkFile file
|
||||
|
||||
-- | Writes a stream of ByteString-based rows to a CSV file
|
||||
writeToCSVRaw
|
||||
:: MonadResource m
|
||||
=> FilePath
|
||||
-- ^ the path to the CSV file to write to
|
||||
-> ConduitT [BS.ByteString] o m ()
|
||||
writeToCSVRaw file = encodeRawRows .| sinkFile file
|
||||
|
||||
-- | encode a CSV stream row by row, each element in the list read
|
||||
-- represents a field, with the entire list representing a row
|
||||
encodeRows :: Monad m => ConduitT [T.Text] BS.ByteString m ()
|
||||
|
Loading…
x
Reference in New Issue
Block a user