[commit: packages/containers] cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394: Add cycleN to changelog; fix up its documentation. (81d4802)

git at git.haskell.org git at git.haskell.org
Mon Apr 17 21:42:32 UTC 2017


Repository : ssh://git@git.haskell.org/containers

On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394
Link       : http://git.haskell.org/packages/containers.git/commitdiff/81d4802ace02dafe8d4709fc923d14d197e306f6

>---------------------------------------------------------------

commit 81d4802ace02dafe8d4709fc923d14d197e306f6
Author: David Feuer <David.Feuer at gmail.com>
Date:   Tue May 24 18:55:18 2016 -0400

    Add cycleN to changelog; fix up its documentation.


>---------------------------------------------------------------

81d4802ace02dafe8d4709fc923d14d197e306f6
 Data/Sequence.hs | 8 +++++---
 changelog.md     | 2 +-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/Data/Sequence.hs b/Data/Sequence.hs
index f042cdf..f08be99 100644
--- a/Data/Sequence.hs
+++ b/Data/Sequence.hs
@@ -1033,15 +1033,17 @@ replicateM n x
   | n >= 0      = unwrapMonad (replicateA n (WrapMonad x))
   | otherwise   = error "replicateM takes a nonnegative integer argument"
 
--- | /O(log(n))/ incremental. @'cycleN' n xs@ forms a sequence of length @n@ by
+-- | /O(log(k))/ incremental. @'cycleN' k xs@ forms a sequence of length @k@ by
 -- repeatedly concatenating @xs@ with itself. @xs@ must not be empty and
--- @n@ must not be negative.
+-- @k@ must not be negative.
 --
--- prop> cycleN n = fromList . take n . cycle . toList
+-- prop> cycleN k = fromList . take k . cycle . toList
 
 -- If you wish to concatenate a non-empty sequence @xs@ with itself precisely
 -- @k@ times, you can use @cycleN (k * length xs)@ or just
 -- @replicate k () *> xs at .
+--
+-- @since 0.5.8
 cycleN :: Int -> Seq a -> Seq a
 cycleN n !_xs | n < 0 = error "cycleN takes a non-negative argument"
 cycleN n xs   | null xs = error "cycleN takes a non-empty sequence"
diff --git a/changelog.md b/changelog.md
index 8617f17..e98c588 100644
--- a/changelog.md
+++ b/changelog.md
@@ -22,7 +22,7 @@
 
   * Add `Empty`, `:<|`, and `:|>` pattern synonyms for `Data.Sequence`.
 
-  * Add `chunksOf`, `intersperse`, `foldMapWithIndex`, and
+  * Add `chunksOf`, `cycleN`, `intersperse`, `foldMapWithIndex`, and
     `traverseWithIndex` for `Data.Sequence`.
 
   * Make `splitAt` in `Data.Sequence` strict in its arguments. Previously,



More information about the ghc-commits mailing list