hw-kafka-conduit 2.4.0 → 2.5.0
raw patch · 2 files changed
+9/−11 lines, 2 filesdep ~hw-kafka-client
Dependency ranges changed: hw-kafka-client
Files
hw-kafka-conduit.cabal view
@@ -1,5 +1,5 @@ name: hw-kafka-conduit-version: 2.4.0+version: 2.5.0 synopsis: Conduit bindings for hw-kafka-client homepage: https://github.com/haskell-works/hw-kafka-conduit bug-reports: https://github.com/haskell-works/hw-kafka-conduit/issues@@ -53,7 +53,7 @@ , conduit , conduit-extra , exceptions- , hw-kafka-client+ , hw-kafka-client >= 2.5 , mtl , resourcet , transformers@@ -74,7 +74,7 @@ , conduit-extra , extra , hspec- , hw-kafka-client+ , hw-kafka-client >= 2.5 , mtl , resourcet , transformers
src/Kafka/Conduit/Combinators.hs view
@@ -7,10 +7,10 @@ , throwLeftSatisfy ) where -import Control.Exception-import Control.Monad-import Control.Monad.Catch-import Data.Conduit+import Control.Monad (forM_)+import Control.Monad.Catch (Exception, MonadThrow, throwM)+import Data.Conduit (Conduit, await, awaitForever, yield)+import Kafka.Types (BatchSize (..)) -- | Throws the left part of a value in a 'MonadThrow' context throwLeft :: (MonadThrow m, Exception e) => Conduit (Either e i) m i@@ -36,8 +36,6 @@ foldYield f g s' Nothing -> forM_ (g s) yield -newtype BatchSize = BatchSize Int deriving (Show, Eq, Ord)- batchByOrFlush :: Monad m => BatchSize -> Conduit (Maybe a) m [a] batchByOrFlush (BatchSize n) = foldYield folder finish (0 :: Int, []) where@@ -49,7 +47,7 @@ batchByOrFlushEither :: Monad m => BatchSize -> Conduit (Either e a) m [a] batchByOrFlushEither (BatchSize n) = foldYield folder finish (0 :: Int, []) where- folder (Left _) (_, xs) = ((0 , []), [reverse xs ])+ folder (Left _) (_, xs) = ((0 , []), [reverse xs ]) folder (Right a) (i, xs) | i + 1 >= n = ((0 , []), [reverse (a:xs)])- folder (Right a) (i, xs) = ((i + 1, a:xs ), [])+ folder (Right a) (i, xs) = ((i + 1, a:xs ), []) finish (_, xs) = [reverse xs]