packages feed

pipes-concurrency 2.0.9 → 2.0.10

raw patch · 2 files changed

+25/−10 lines, 2 filesdep +semigroupsdep ~base

Dependencies added: semigroups

Dependency ranges changed: base

Files

pipes-concurrency.cabal view
@@ -1,5 +1,5 @@ Name: pipes-concurrency-Version: 2.0.9+Version: 2.0.10 Cabal-Version: >=1.8.0.2 Build-Type: Simple License: BSD3@@ -31,16 +31,17 @@ Library     Hs-Source-Dirs: src     Build-Depends:-        base          >= 4       && < 5  ,-        async         >= 2.0.0.0 && < 2.3,-        contravariant >= 1.3.3   && < 1.5,-        pipes         >= 4.0     && < 4.4,-        stm           >= 2.4.3   && < 2.5,+        base          >= 4       && < 5   ,+        async         >= 2.0.0.0 && < 2.3 ,+        contravariant >= 1.3.3   && < 1.5 ,+        pipes         >= 4.0     && < 4.4 ,+        semigroups                  < 0.19,+        stm           >= 2.4.3   && < 2.5 ,         void          >= 0.6     && < 1     Exposed-Modules:         Pipes.Concurrent,         Pipes.Concurrent.Tutorial-    GHC-Options: -O2+    GHC-Options: -O2 -Wall -Wcompat  Test-Suite tests     Type: exitcode-stdio-1.0
src/Pipes/Concurrent.hs view
@@ -1,6 +1,6 @@ -- | Asynchronous communication between pipes -{-# LANGUAGE RankNTypes, Safe #-}+{-# LANGUAGE CPP, RankNTypes, Safe #-}  module Pipes.Concurrent (     -- * Inputs and Outputs@@ -39,8 +39,10 @@ import Data.Functor.Contravariant.Divisible (     Divisible(divide, conquer), Decidable(lose, choose)) import Data.Monoid (Monoid(mempty, mappend))+import Data.Semigroup import Data.Void (absurd) import Pipes (MonadIO(liftIO), yield, await, Producer', Consumer')+import Prelude hiding (read) import System.Mem (performGC)  import qualified Control.Concurrent.Async@@ -81,10 +83,16 @@     mzero = empty     mplus = (<|>) +instance Data.Semigroup.Semigroup (Input a) where+    (<>) = (<|>)+ instance Monoid (Input a) where     mempty = empty-    mappend = (<|>) +#if !(MIN_VERSION_base(4,11,0))+    mappend = (<>)+#endif+ {-| An exhaustible sink of values      'send' returns 'False' if the sink is exhausted@@ -92,9 +100,15 @@ newtype Output a = Output {     send :: a -> S.STM Bool } +instance Data.Semigroup.Semigroup (Output a) where+    i1 <> i2 = Output (\a -> (||) <$> send i1 a <*> send i2 a)+ instance Monoid (Output a) where     mempty  = Output (\_ -> return False)-    mappend i1 i2 = Output (\a -> (||) <$> send i1 a <*> send i2 a)++#if !(MIN_VERSION_base(4,11,0))+    mappend = (<>)+#endif  -- | This instance is useful for creating new tagged address, similar to elm's -- Signal.forwardTo. In fact elm's forwardTo is just 'flip contramap'