[commit: packages/containers] master: Add warning about Seq size. (74afe96)

git at git.haskell.org git at git.haskell.org
Fri Dec 18 22:11:46 UTC 2015


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

On branch  : master
Link       : http://git.haskell.org/packages/containers.git/commitdiff/74afe969cc792ab30715f6ad7399bddb492a1b66

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

commit 74afe969cc792ab30715f6ad7399bddb492a1b66
Author: David Feuer <David.Feuer at gmail.com>
Date:   Wed Dec 31 01:24:48 2014 -0500

    Add warning about Seq size.


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

74afe969cc792ab30715f6ad7399bddb492a1b66
 Data/Map.hs        |  4 ++++
 Data/Map/Lazy.hs   |  4 ++++
 Data/Map/Strict.hs |  4 ++++
 Data/Sequence.hs   | 14 +++++++++++---
 Data/Set.hs        |  4 ++++
 Data/Set/Base.hs   |  4 ++++
 6 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/Data/Map.hs b/Data/Map.hs
index 1281f2f..e4af46a 100644
--- a/Data/Map.hs
+++ b/Data/Map.hs
@@ -45,6 +45,10 @@
 -- first argument are always preferred to the second, for example in
 -- 'union' or 'insert'.
 --
+-- /Warning/: The size of the map must not exceed @maxBound::Int at . Violation of
+-- this condition is not detected and if the size limit is exceeded, its
+-- behaviour is undefined.
+--
 -- Operation comments contain the operation time complexity in
 -- the Big-O notation (<http://en.wikipedia.org/wiki/Big_O_notation>).
 -----------------------------------------------------------------------------
diff --git a/Data/Map/Lazy.hs b/Data/Map/Lazy.hs
index 2705de5..17fa6fe 100644
--- a/Data/Map/Lazy.hs
+++ b/Data/Map/Lazy.hs
@@ -44,6 +44,10 @@
 -- first argument are always preferred to the second, for example in
 -- 'union' or 'insert'.
 --
+-- /Warning/: The size of the map must not exceed @maxBound::Int at . Violation of
+-- this condition is not detected and if the size limit is exceeded, its
+-- behaviour is undefined.
+--
 -- Operation comments contain the operation time complexity in
 -- the Big-O notation (<http://en.wikipedia.org/wiki/Big_O_notation>).
 -----------------------------------------------------------------------------
diff --git a/Data/Map/Strict.hs b/Data/Map/Strict.hs
index 7309041..623b1df 100644
--- a/Data/Map/Strict.hs
+++ b/Data/Map/Strict.hs
@@ -44,6 +44,10 @@
 -- first argument are always preferred to the second, for example in
 -- 'union' or 'insert'.
 --
+-- /Warning/: The size of the map must not exceed @maxBound::Int at . Violation of
+-- this condition is not detected and if the size limit is exceeded, its
+-- behaviour is undefined.
+--
 -- Operation comments contain the operation time complexity in
 -- the Big-O notation (<http://en.wikipedia.org/wiki/Big_O_notation>).
 --
diff --git a/Data/Sequence.hs b/Data/Sequence.hs
index 11f1880..21c54d3 100644
--- a/Data/Sequence.hs
+++ b/Data/Sequence.hs
@@ -16,7 +16,8 @@
 -- Module      :  Data.Sequence
 -- Copyright   :  (c) Ross Paterson 2005
 --                (c) Louis Wasserman 2009
---                (c) David Feuer, Ross Paterson, and Milan Straka 2014
+--                (c) Bertram Felgenhauer, David Feuer, Ross Paterson, and
+--                    Milan Straka 2014
 -- License     :  BSD-style
 -- Maintainer  :  libraries at haskell.org
 -- Stability   :  experimental
@@ -29,7 +30,7 @@
 --
 -- An amortized running time is given for each operation, with /n/ referring
 -- to the length of the sequence and /i/ being the integral index used by
--- some operations.  These bounds hold even in a persistent (shared) setting.
+-- some operations. These bounds hold even in a persistent (shared) setting.
 --
 -- The implementation uses 2-3 finger trees annotated with sizes,
 -- as described in section 4.2 of
@@ -40,9 +41,16 @@
 --      <http://staff.city.ac.uk/~ross/papers/FingerTree.html>
 --
 -- /Note/: Many of these operations have the same names as similar
--- operations on lists in the "Prelude".  The ambiguity may be resolved
+-- operations on lists in the "Prelude". The ambiguity may be resolved
 -- using either qualification or the @hiding@ clause.
 --
+-- /Warning/: The size of a 'Seq' must not exceed @maxBound::Int at .  Violation
+-- of this condition is not detected and if the size limit is exceeded, the
+-- behaviour of the sequence is undefined.  This is unlikely to occur in most
+-- applications, but some care may be required when using '><', '<*>', '*>', or
+-- '>>', particularly repeatedly and particularly in combination with
+-- 'replicate' or 'fromFunction'.
+--
 -----------------------------------------------------------------------------
 
 module Data.Sequence (
diff --git a/Data/Set.hs b/Data/Set.hs
index 37366fe..fd8c8b9 100644
--- a/Data/Set.hs
+++ b/Data/Set.hs
@@ -38,6 +38,10 @@
 -- 'union' or 'insert'.  Of course, left-biasing can only be observed
 -- when equality is an equivalence relation instead of structural
 -- equality.
+--
+-- /Warning/: The size of the set must not exceed @maxBound::Int at . Violation of
+-- this condition is not detected and if the size limit is exceeded, its
+-- behaviour is undefined.
 -----------------------------------------------------------------------------
 
 module Data.Set (
diff --git a/Data/Set/Base.hs b/Data/Set/Base.hs
index e1ebad3..616d0eb 100644
--- a/Data/Set/Base.hs
+++ b/Data/Set/Base.hs
@@ -45,6 +45,10 @@
 -- 'union' or 'insert'.  Of course, left-biasing can only be observed
 -- when equality is an equivalence relation instead of structural
 -- equality.
+--
+-- /Warning/: The size of the set must not exceed @maxBound::Int at . Violation of
+-- this condition is not detected and if the size limit is exceeded, its
+-- behaviour is undefined.
 -----------------------------------------------------------------------------
 
 -- [Note: Using INLINABLE]



More information about the ghc-commits mailing list