@@ -61,7 +61,7 @@ import Data.IORef (IORef, modifyIORef, newIORef,
61import Data.Atomics (atomicModifyIORefCAS,
61import Data.Atomics (atomicModifyIORefCAS,
62 atomicModifyIORefCAS_)
62 atomicModifyIORefCAS_)
63import Data.Maybe (isNothing)
63import Data.Maybe (isNothing)
64−import Data.Monoid ((<>))
64+import Data.Semigroup (Semigroup(..))
65import Data.Set (Set)
65import Data.Set (Set)
66import qualified Data.Set as S
66import qualified Data.Set as S
67import Prelude hiding (take, drop)
67import Prelude hiding (take, drop)
@@ -118,14 +118,18 @@ type MonadAsync m = (MonadIO m, MonadBaseControl IO m, MonadThrow m)
118------------------------------------------------------------------------------
118------------------------------------------------------------------------------
120-- | Appends the results of two AsyncT computations in order.
120-- | Appends the results of two AsyncT computations in order.
121−instance Monad m => Monoid (AsyncT m a) where
121+instance Semigroup (AsyncT m a) where
122− mempty = AsyncT $ \_ stp _ -> stp
123− mappend (AsyncT m1) m2 = AsyncT $ \ctx stp yld ->
122+ (AsyncT m1) <> m2 = AsyncT $ \ctx stp yld ->
124 let stop = (runAsyncT m2) ctx stp yld
123 let stop = (runAsyncT m2) ctx stp yld
125 yield a c Nothing = yld a c (Just m2)
124 yield a c Nothing = yld a c (Just m2)
126 yield a c (Just r) = yld a c (Just (mappend r m2))
125 yield a c (Just r) = yld a c (Just (mappend r m2))
127 in m1 ctx stop yield
126 in m1 ctx stop yield
128+-- | Appends the results of two AsyncT computations in order.
129+instance Monoid (AsyncT m a) where
130+ mempty = AsyncT $ \_ stp _ -> stp
129-- | Interleaves the results of two 'AsyncT' streams
133-- | Interleaves the results of two 'AsyncT' streams
130interleave :: AsyncT m a -> AsyncT m a -> AsyncT m a
134interleave :: AsyncT m a -> AsyncT m a -> AsyncT m a
131interleave m1 m2 = AsyncT $ \ctx stp yld -> do
135interleave m1 m2 = AsyncT $ \ctx stp yld -> do