@@ -61,7 +61,7 @@ import Data.IORef (IORef, modifyIORef, newIORef,
6161import Data.Atomics (atomicModifyIORefCAS,
6262 atomicModifyIORefCAS_)
6363import Data.Maybe (isNothing)
64−import Data.Monoid ((<>))
64+import Data.Semigroup (Semigroup(..))
6565import Data.Set (Set)
6666import qualified Data.Set as S
6767import Prelude hiding (take, drop)
@@ -118,14 +118,18 @@ type MonadAsync m = (MonadIO m, MonadBaseControl IO m, MonadThrow m)
118118------------------------------------------------------------------------------
119119
120120-- | Appends the results of two AsyncT computations in order.
121−instance Monad m => Monoid (AsyncT m a) where
122− mempty = AsyncT $ \_ stp _ -> stp
123− mappend (AsyncT m1) m2 = AsyncT $ \ctx stp yld ->
121+instance Semigroup (AsyncT m a) where
122+ (AsyncT m1) <> m2 = AsyncT $ \ctx stp yld ->
124123 let stop = (runAsyncT m2) ctx stp yld
125124 yield a c Nothing = yld a c (Just m2)
126125 yield a c (Just r) = yld a c (Just (mappend r m2))
127126 in m1 ctx stop yield
128127
128+-- | Appends the results of two AsyncT computations in order.
129+instance Monoid (AsyncT m a) where
130+ mempty = AsyncT $ \_ stp _ -> stp
131+ mappend = (<>)
132+
129133-- | Interleaves the results of two 'AsyncT' streams
130134interleave :: AsyncT m a -> AsyncT m a -> AsyncT m a
131135interleave m1 m2 = AsyncT $ \ctx stp yld -> do