on master help sign in
Move common idioms from Generate to Data.Stream
d33bb11Harendra Kumar
core/src/Streamly/Data/Stream.hs+8
@@ -75,6 +75,14 @@
75-- "Data.List" like functions and many more powerful combinators to perform
75-- "Data.List" like functions and many more powerful combinators to perform
76-- common programming tasks.
76-- common programming tasks.
77--
77--
78+-- Some common idioms:
79+--
80+-- >>> repeatM = Stream.sequence . Stream.repeat
81+-- >>> replicateM n = Stream.sequence . Stream.replicate n
82+-- >>> fromListM = Stream.sequence . Stream.fromList
83+-- >>> fromFoldableM = Stream.sequence . Stream.fromFoldable
84+-- >>> fromIndices f = fmap f $ Stream.enumerateFrom 0
85+--
78-- Also see "Streamly.Internal.Data.Stream" module for many more @Pre-release@
86-- Also see "Streamly.Internal.Data.Stream" module for many more @Pre-release@
79-- combinators. See the <https://github.com/composewell/streamly-examples>
87-- combinators. See the <https://github.com/composewell/streamly-examples>
80-- repository for many more real world examples of stream programming.
88-- repository for many more real world examples of stream programming.
core/src/Streamly/Internal/Data/Stream/Generate.hs−9
@@ -8,15 +8,6 @@
8-- Stability : experimental
8-- Stability : experimental
9-- Portability : GHC
9-- Portability : GHC
10--
10--
11−-- Some idioms:
12−--
13−-- >>> fromEffect = Stream.sequence . Stream.fromPure
14−-- >>> fromIndices f = fmap f $ Stream.enumerateFrom 0
15−-- >>> repeatM = Stream.sequence . Stream.repeat
16−-- >>> replicateM n = Stream.sequence . Stream.replicate n
17−-- >>> fromListM = Stream.sequence . Stream.fromList
18−-- >>> fromFoldableM = Stream.sequence . Stream.fromFoldable
19−--
20module Streamly.Internal.Data.Stream.Generate
11module Streamly.Internal.Data.Stream.Generate
21 (
12 (
22 -- * Primitives
13 -- * Primitives