implemented slurpRawCSV
This commit is contained in:
parent
8533e84caa
commit
2af6966192
|
@ -28,6 +28,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
module Data.CSV.Sip (
|
module Data.CSV.Sip (
|
||||||
-- * Read an entire CSV file
|
-- * Read an entire CSV file
|
||||||
slurpCSV,
|
slurpCSV,
|
||||||
|
slurpRawCSV,
|
||||||
-- * Conduits
|
-- * Conduits
|
||||||
labelFields,
|
labelFields,
|
||||||
decodeRows,
|
decodeRows,
|
||||||
|
@ -61,6 +62,10 @@ import Data.Word (Word8)
|
||||||
slurpCSV :: MonadResource m => FilePath -> m [[T.Text]]
|
slurpCSV :: MonadResource m => FilePath -> m [[T.Text]]
|
||||||
slurpCSV file = runConduit $ sourceFile file .| decodeRows .| consume
|
slurpCSV file = runConduit $ sourceFile file .| decodeRows .| consume
|
||||||
|
|
||||||
|
-- | read an entire CSV file in raw mode
|
||||||
|
slurpRawCSV :: MonadResource m => FilePath -> m [[BS.ByteString]]
|
||||||
|
slurpRawCSV file = runConduit $ sourceFile file .| decodeRawRows .| consume
|
||||||
|
|
||||||
-- | read a CSV stream, using the first row as a header containing
|
-- | read a CSV stream, using the first row as a header containing
|
||||||
-- field labels
|
-- field labels
|
||||||
labelFields :: (Monad m, Ord a) => ConduitT [a] (M.Map a a) m ()
|
labelFields :: (Monad m, Ord a) => ConduitT [a] (M.Map a a) m ()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user