on master help sign in
Update doc of fromIndices
bffdd45Harendra Kumar
src/Streamly/Internal/Data/Stream/IsStream/Generate.hs+6−1
@@ -374,8 +374,12 @@ timeout = undefined
374-- From Generator functions
374-- From Generator functions
375------------------------------------------------------------------------------
375------------------------------------------------------------------------------
376
376
377+-- XXX we can remove it and recommend the definition in terms of enumerate and
378+-- map. Check performance equivalence.
379+--
377-- |
380-- |
378-- @
381-- @
382+-- fromIndices f = fmap f $ Stream.enumerateFrom 0
379-- fromIndices f = let g i = f i \`cons` g (i + 1) in g 0
383-- fromIndices f = let g i = f i \`cons` g (i + 1) in g 0
380-- @
384-- @
381--
385--
@@ -383,7 +387,7 @@ timeout = undefined
383-- applied on the corresponding index. Index starts at 0.
387-- applied on the corresponding index. Index starts at 0.
384--
388--
385-- @
389-- @
386−-- > S.toList $ S.take 5 $ S.fromIndices id
390+-- > Stream.toList $ Stream.take 5 $ Stream.fromIndices id
387-- [0,1,2,3,4]
391-- [0,1,2,3,4]
388-- @
392-- @
389--
393--
@@ -395,6 +399,7 @@ fromIndices = fromStreamS . S.fromIndices
395--
399--
396-- |
400-- |
397-- @
401-- @
402+-- fromIndicesM f = Stream.mapM f $ Stream.enumerateFrom 0
398-- fromIndicesM f = let g i = f i \`consM` g (i + 1) in g 0
403-- fromIndicesM f = let g i = f i \`consM` g (i + 1) in g 0
399-- @
404-- @
400--
405--