@@ -24,6 +24,7 @@ module Asyncly.AsyncT
@@ -717,6 +718,16 @@ uncons m = (runAsyncT m) Nothing stop yield
717 yield a Nothing = return (Just (a, empty))
718 yield a Nothing = return (Just (a, empty))
718 yield a (Just x) = return (Just (a, x))
719 yield a (Just x) = return (Just (a, x))
721+-- | Build a Stream by unfolding steps starting from a seed.
722+unfoldr :: MonadAsync m => (b -> m (Maybe (a, b))) -> b -> AsyncT m a
725+ go s = AsyncT $ \_ stp yld -> do
729+ Just (a, b) -> yld a (Just (go b))
720------------------------------------------------------------------------------
731------------------------------------------------------------------------------
721-- Transformation
732-- Transformation
722------------------------------------------------------------------------------
733------------------------------------------------------------------------------
@@ -769,7 +780,7 @@ zipWith f m1 m2 = AsyncT $ \_ stp yld -> do
769 (runAsyncT m1) Nothing stp yield1
780 (runAsyncT m1) Nothing stp yield1
771-- | Wrapper around AsyncT type with a serial zipping Applicative instance.
782-- | Wrapper around AsyncT type with a serial zipping Applicative instance.
772−-- Note that the binary function interleave (<=>) is a special case of
783+-- Note that the binary function interleave (\<=>) is a special case of
773-- ZipSerial Applicative.
784-- ZipSerial Applicative.
775-- > f <$> ZipSerial xs1 <*> ... <*> ZipSerial xsN
786-- > f <$> ZipSerial xs1 <*> ... <*> ZipSerial xsN
@@ -835,7 +846,7 @@ zipAsyncWith f m1 m2 = AsyncT $ \_ stp yld -> do
835 (runAsyncT (zipWith f ma mb)) Nothing stp yld
846 (runAsyncT (zipWith f ma mb)) Nothing stp yld
837-- | Wrapper around AsyncT type with a parallel zipping Applicative instance.
848-- | Wrapper around AsyncT type with a parallel zipping Applicative instance.
838−-- Note that the binary operator (<|>) from the Alternative instance of AsyncT
849+-- Note that the binary operator (\<|>) from the Alternative instance of AsyncT
839-- is a special case of ZipAsync Applicative.
850-- is a special case of ZipAsync Applicative.
841-- > f <$> ZipAsync xs1 <*> ... <*> ZipAsync xsN
852-- > f <$> ZipAsync xs1 <*> ... <*> ZipAsync xsN