on master help sign in
Make minor changes to docs and update changelog
2e7c628Harendra Kumar
Changelog.md+1
@@ -1,6 +1,7 @@
1## Unreleased
1## Unreleased
2
2
3### Enhancements
3### Enhancements
4+* Make `cons` right associative and provide an operator form `.:` for it
4* Add `null`, `tail`, `reverse`, `replicateM`, `scan` stream operations
5* Add `null`, `tail`, `reverse`, `replicateM`, `scan` stream operations
5* Improve performance of some stream operations (`foldl`, `dropWhile`)
6* Improve performance of some stream operations (`foldl`, `dropWhile`)
6
7
src/Streamly/Prelude.hs+2−1
@@ -380,7 +380,7 @@ notElem e m = go (toStream m)
380length :: (Streaming t, Monad m) => t m a -> m Int
380length :: (Streaming t, Monad m) => t m a -> m Int
381length = foldl (\n _ -> n + 1) 0 id
381length = foldl (\n _ -> n + 1) 0 id
382
382
383−-- | Returns the elements of the stream in reverse order.
383+-- | Returns the elements of the stream in reverse order.
384-- The stream must be finite.
384-- The stream must be finite.
385reverse :: (Streaming t) => t m a -> t m a
385reverse :: (Streaming t) => t m a -> t m a
386reverse m = fromStream $ go Nothing (toStream m)
386reverse m = fromStream $ go Nothing (toStream m)
@@ -463,6 +463,7 @@ sequence m = fromStream $ go (toStream m)
463 yield a (Just x) = a >>= \b -> yld b (Just (go x))
463 yield a (Just x) = a >>= \b -> yld b (Just (go x))
464 in (runStream m1) Nothing stop yield
464 in (runStream m1) Nothing stop yield
465
465
466+-- | Generate a stream by performing an action @n@ times.
466replicateM :: (Streaming t, Monad m) => Int -> m a -> t m a
467replicateM :: (Streaming t, Monad m) => Int -> m a -> t m a
467replicateM n m = fromStream $ go n
468replicateM n m = fromStream $ go n
468 where
469 where
src/Streamly/Streams.hs+1−1
@@ -112,7 +112,7 @@ class Streaming t where
112-- Constructing a stream
112-- Constructing a stream
113------------------------------------------------------------------------------
113------------------------------------------------------------------------------
114
114
115−-- | Represesnts an empty stream just like @[]@ represents and empty list.
115+-- | Represesnts an empty stream just like @[]@ represents an empty list.
116nil :: Streaming t => t m a
116nil :: Streaming t => t m a
117nil = fromStream snil
117nil = fromStream snil
118
118