csv-conduit 0.3.0.3 → 0.4.1
raw patch · 2 files changed
+18/−7 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Data.CSV.Conduit: instance CSV ByteString (Row String)
- Data.CSV.Conduit: fromCSV :: (CSV s r, MonadResource m) => CSVSettings -> GInfConduit r m s
+ Data.CSV.Conduit: fromCSV :: (CSV s r, Monad m) => CSVSettings -> GInfConduit r m s
- Data.CSV.Conduit: intoCSV :: (CSV s r, MonadResource m) => CSVSettings -> GLInfConduit s m r
+ Data.CSV.Conduit: intoCSV :: (CSV s r, MonadThrow m) => CSVSettings -> GLInfConduit s m r
- Data.CSV.Conduit: mapCSVFile :: (MonadResource m, CSV ByteString a, CSV ByteString b) => CSVSettings -> (a -> [b]) -> FilePath -> FilePath -> m ()
+ Data.CSV.Conduit: mapCSVFile :: (MonadResource m, MonadThrow m, CSV ByteString a, CSV ByteString b) => CSVSettings -> (a -> [b]) -> FilePath -> FilePath -> m ()
- Data.CSV.Conduit: transformCSV :: (MonadResource m, CSV s a, CSV s' b) => CSVSettings -> Source m s -> Conduit a m b -> Sink s' m () -> m ()
+ Data.CSV.Conduit: transformCSV :: (MonadThrow m, CSV s a, CSV s' b) => CSVSettings -> Source m s -> Conduit a m b -> Sink s' m () -> m ()
- Data.CSV.Conduit: writeHeaders :: (MonadResource m, CSV s (Row r), IsString s) => CSVSettings -> GConduit (MapRow r) m s
+ Data.CSV.Conduit: writeHeaders :: (Monad m, CSV s (Row r), IsString s) => CSVSettings -> GConduit (MapRow r) m s
Files
- csv-conduit.cabal +1/−1
- src/Data/CSV/Conduit.hs +17/−6
csv-conduit.cabal view
@@ -1,5 +1,5 @@ Name: csv-conduit-Version: 0.3.0.3+Version: 0.4.1 Synopsis: A flexible, fast, conduit-based CSV parser library for Haskell. Homepage: http://github.com/ozataman/csv-conduit License: BSD3
src/Data/CSV/Conduit.hs view
@@ -99,13 +99,13 @@ ----------------------------------------------------------------------------- -- | Turn a stream of 's' into a stream of CSV row type. An example -- would be parsing a ByteString stream as rows of 'MapRow' 'Text'.- intoCSV :: MonadResource m => CSVSettings -> GLInfConduit s m r+ intoCSV :: (MonadThrow m) => CSVSettings -> GLInfConduit s m r ----------------------------------------------------------------------------- -- | Turn a stream of CSV row type back into a stream of 's'. An -- example would be rendering a stream of 'Row' 'ByteString' rows as -- 'Text'.- fromCSV :: MonadResource m => CSVSettings -> GInfConduit r m s+ fromCSV :: Monad m => CSVSettings -> GInfConduit r m s @@ -153,6 +153,17 @@ -------------------------------------------------------------------------------+-- | 'Row' instance using 'String' based on 'ByteString' stream.+-- Please note this uses the ByteString operations underneath and has+-- lots of unnecessary overhead. Included for convenience.+instance CSV ByteString (Row String) where+ rowToStr s r = rowToStr s $ map B8.pack r+ intoCSV set = intoCSV set >+> C.map (map B8.unpack)+ fromCSV set = C.map (map B8.pack) >+> fromCSV set++++------------------------------------------------------------------------------- fromCSVRow :: (Monad m, IsString s, CSV s r) => CSVSettings -> GInfConduit r m s fromCSVRow set = do@@ -189,7 +200,7 @@ --------------------------------------------------------------------------------intoCSVMap :: (Ord a, MonadResource m, CSV s [a])+intoCSVMap :: (Ord a, MonadThrow m, CSV s [a]) => CSVSettings -> GLInfConduit s m (MapRow a) intoCSVMap set = intoCSV set >+> (headers >>= converter) where@@ -225,7 +236,7 @@ -- -- > ... =$= writeHeaders settings >> fromCSV settings $$ sinkFile "..." writeHeaders- :: (MonadResource m, CSV s (Row r), IsString s)+ :: (Monad m, CSV s (Row r), IsString s) => CSVSettings -> GConduit (MapRow r) m s writeHeaders set = do@@ -284,7 +295,7 @@ -- An easy way to run this function would be 'runResourceT' after -- feeding it all the arguments. mapCSVFile- :: (MonadResource m, CSV ByteString a, CSV ByteString b)+ :: (MonadResource m, MonadThrow m, CSV ByteString a, CSV ByteString b) => CSVSettings -- ^ Settings to use both for input and output -> (a -> [b])@@ -311,7 +322,7 @@ -- -- > transformCSV set (sourceFile inFile) (C.map f) (sinkFile outFile) transformCSV- :: (MonadResource m, CSV s a, CSV s' b)+ :: (MonadThrow m, CSV s a, CSV s' b) => CSVSettings -- ^ Settings to be used for input and output -> Source m s