implemented slurpRawLabelledCSV
This commit is contained in:
parent
51784123cd
commit
724dfe0345
|
@ -30,6 +30,7 @@ module Data.CSV.Sip (
|
||||||
slurpCSV,
|
slurpCSV,
|
||||||
slurpRawCSV,
|
slurpRawCSV,
|
||||||
slurpLabelledCSV,
|
slurpLabelledCSV,
|
||||||
|
slurpRawLabelledCSV,
|
||||||
-- * Conduits
|
-- * Conduits
|
||||||
labelFields,
|
labelFields,
|
||||||
decodeRows,
|
decodeRows,
|
||||||
|
@ -84,6 +85,15 @@ slurpLabelledCSV
|
||||||
slurpLabelledCSV file = runConduit $
|
slurpLabelledCSV file = runConduit $
|
||||||
sourceFile file .| decodeRows .| labelFields .|consume
|
sourceFile file .| decodeRows .| labelFields .|consume
|
||||||
|
|
||||||
|
-- | read an entire CSV file with a header
|
||||||
|
slurpRawLabelledCSV
|
||||||
|
:: MonadResource m
|
||||||
|
=> FilePath
|
||||||
|
-- ^ the path to the file to read
|
||||||
|
-> m [M.Map BS.ByteString BS.ByteString]
|
||||||
|
slurpRawLabelledCSV file = runConduit $
|
||||||
|
sourceFile file .| decodeRawRows .| labelFields .|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