@@ -9,6 +9,7 @@
99
1010module LinearOps where
1111
12+import Data.Maybe (fromJust)
1213import Prelude
1314 (Monad, Int, (+), ($), (.), return, fmap, even, (>), (<=),
1415 subtract, undefined, Maybe(..), odd, Bool, not)
@@ -42,13 +43,14 @@ maxValue = value + 1000
4243{-# INLINE dropWhileTrue #-}
4344{-# INLINE dropWhileMTrue #-}
4445{-# INLINE zip #-}
46+{-# INLINE zipM #-}
4547{-# INLINE concat #-}
4648{-# INLINE composeAllInFilters #-}
4749{-# INLINE composeAllOutFilters #-}
4850{-# INLINE composeMapAllInFilter #-}
4951uncons, nullHeadTail, scan, mapM_, map, fmap, mapMaybe, filterEven, filterAllOut,
5052 filterAllIn, takeOne, takeAll, takeWhileTrue, takeWhileMTrue, dropAll,
51− dropWhileTrue, dropWhileMTrue, zip,
53+ dropWhileTrue, dropWhileMTrue, zip, zipM,
5254 concat, composeAllInFilters, composeAllOutFilters,
5355 composeMapAllInFilter
5456 :: Monad m
@@ -56,8 +58,9 @@ uncons, nullHeadTail, scan, mapM_, map, fmap, mapMaybe, filterEven, filterAllOut
5658
5759{-# INLINE composeMapM #-}
5860{-# INLINE zipAsync #-}
61+{-# INLINE zipAsyncM #-}
5962{-# INLINE mapMaybeM #-}
60−composeMapM, zipAsync, mapMaybeM :: S.MonadAsync m => Stream m Int -> m ()
63+composeMapM, zipAsync, zipAsyncM, mapMaybeM :: S.MonadAsync m => Stream m Int -> m ()
6164
6265{-# INLINE toList #-}
6366{-# INLINE foldr #-}
@@ -228,8 +231,22 @@ dropWhileMTrue = transform . S.dropWhileM (return . (<= maxValue))
228231-- Zipping and concat
229232-------------------------------------------------------------------------------
230233
231−zip src = transform $ (S.zipWith (,) src src)
232−zipAsync src = transform $ (S.zipAsyncWith (,) src src)
234+zip src = do
235+ r <- S.tail src
236+ let src1 = fromJust r
237+ transform $ (S.zipWith (,) src src1)
238+zipM src = do
239+ r <- S.tail src
240+ let src1 = fromJust r
241+ transform $ (S.zipWithM (\a b -> return (a,b)) src src1)
242+zipAsync src = do
243+ r <- S.tail src
244+ let src1 = fromJust r
245+ transform $ (S.zipAsyncWith (,) src src1)
246+zipAsyncM src = do
247+ r <- S.tail src
248+ let src1 = fromJust r
249+ transform $ (S.zipAsyncWithM (\a b -> return (a,b)) src src1)
233250concat _n = return ()
234251
235252-------------------------------------------------------------------------------