simple-conduit 0.0.1 → 0.0.2
raw patch · 2 files changed
+29/−2 lines, 2 files
Files
- Conduit/Simple.hs +28/−1
- simple-conduit.cabal +1/−1
Conduit/Simple.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE RankNTypes #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TupleSections #-} {-# LANGUAGE FlexibleContexts #-}@@ -761,10 +762,36 @@ -- -- >>> sinkList $ sequenceSources [yieldOne 1, yieldOne 2, yieldOne 3] -- [[1,2,3]]- sequenceSources :: (Traversable f, Monad m) => f (Source m a r) -> Source m (f a) r sequenceSources = getZipSource . sequenceA . fmap ZipSource++zipSinks :: Monad m+ => (Source m i rs -> m r)+ -> (Source m i rs' -> m r')+ -> (forall s. Source m i s)+ -> m (r, r')+zipSinks x y await = liftM2 (,) (x await) (y await)++newtype ZipSink i m r s = ZipSink { getZipSink :: Source m i r -> m s }++instance Monad m => Functor (ZipSink i m r) where+ fmap f (ZipSink k) = ZipSink $ liftM f . k++instance Monad m => Applicative (ZipSink i m r) where+ pure x = ZipSink $ \_ -> return x+ ZipSink f <*> ZipSink x =+ ZipSink $ \await -> f await `ap` x await++-- | Send incoming values to all of the @Sink@ providing, and ultimately+-- coalesce together all return values.+--+-- Implemented on top of @ZipSink@, see that data type for more details.+--+-- Since 1.0.13+sequenceSinks :: (Traversable f, Monad m)+ => f (Source m i r -> m s) -> Source m i r -> m (f s)+sequenceSinks = getZipSink . sequenceA . fmap ZipSink asyncC :: (MonadBaseControl IO m, Monad m) => (a -> m b) -> Conduit a m (Async (StM m b)) r
simple-conduit.cabal view
@@ -1,5 +1,5 @@ Name: simple-conduit-Version: 0.0.1+Version: 0.0.2 Synopsis: A simple streaming library based on composing monadic folds. Description: @simple-conduit@ follows a similar UI to the more capable @conduit@ library, but reduces the scope of what it can solve donw to what can be expressed by chaining monadic folds that allow for early termination. This allows for more predictable resource management behavior, at the cost of not allowing scenarios that @conduit@ is better designed.