packages feed

pipes 4.1.3 → 4.1.4

raw patch · 3 files changed

+16/−18 lines, 3 filesdep ~criterion

Dependency ranges changed: criterion

Files

pipes.cabal view
@@ -1,5 +1,5 @@ Name: pipes
-Version: 4.1.3
+Version: 4.1.4
 Cabal-Version: >= 1.10
 Build-Type: Simple
 License: BSD3
@@ -66,7 +66,7 @@ 
     Build-Depends:
         base      >= 4       && < 5  ,
-        criterion >= 0.6.2.1 && < 0.9,
+        criterion >= 0.6.2.1 && < 1.1,
         mtl       >= 2.1     && < 2.3,
         pipes     >= 4.0.0   && < 4.2
 
@@ -95,7 +95,7 @@ 
     Build-Depends:
         base         >= 4       && < 5  ,
-        criterion    >= 0.6.2.1 && < 0.9,
+        criterion    >= 0.6.2.1 && < 1.1,
         deepseq                         ,
         mtl          >= 2.1     && < 2.3,
         pipes        >= 4.0.0   && < 4.2,
src/Pipes.hs view
@@ -414,20 +414,9 @@ 
     catchError l k = Select (catchError (enumerate l) (\e -> enumerate (k e)))
 
-{-| Run a self-contained 'ListT' computation
-
-    Note: 'runListT` only accepts empty 'ListT's, to prevent accidentally
-    discarding values.  You can explicitly confirm that you want to discard the
-    value using 'mempty' or 'mzero':
-
-> example :: ListT m ()  -- `()` will not type-check as `X`
->
-> main = runListT $ do
->     example
->     mzero  -- `mzero`'s return value will type-check as `X`
--}
-runListT :: Monad m => ListT m X -> m ()
-runListT l = runEffect (enumerate l)
+-- | Run a self-contained `ListT` computation
+runListT :: Monad m => ListT m a -> m ()
+runListT l = runEffect (enumerate (l >> mzero))
 {-# INLINABLE runListT #-}
 
 {-| 'Enumerable' generalizes 'Data.Foldable.Foldable', converting effectful
src/Pipes/Internal.hs view
@@ -45,7 +45,7 @@ import Control.Monad.Reader (MonadReader(..))
 import Control.Monad.State (MonadState(..))
 import Control.Monad.Writer (MonadWriter(..))
-import Data.Monoid (mempty,mappend)
+import Data.Monoid (Monoid(mempty,mappend))
 
 {-| A 'Proxy' is a monad transformer that receives and sends information on both
     an upstream and downstream interface.
@@ -112,6 +112,15 @@     "_bind (Pure    r   ) f" forall r    f .
         _bind (Pure    r   ) f = f r;
   #-}
+
+instance (Monad m, Monoid r) => Monoid (Proxy a' a b' b m r) where
+    mempty        = Pure mempty
+    mappend p1 p2 = go p1 where
+        go p = case p of
+            Request a' fa  -> Request a' (\a  -> go (fa  a ))
+            Respond b  fb' -> Respond b  (\b' -> go (fb' b'))
+            M          m   -> M (m >>= \p' -> return (go p'))
+            Pure    r1     -> fmap (mappend r1) p2
 
 instance MonadTrans (Proxy a' a b' b) where
     lift m = M (m >>= \r -> return (Pure r))