Skip to content

Commit 74afe96

Browse files
committed
Add warning about Seq size.
1 parent 202e2f2 commit 74afe96

File tree

6 files changed

+31
-3
lines changed

6 files changed

+31
-3
lines changed

Data/Map.hs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@
4545
-- first argument are always preferred to the second, for example in
4646
-- 'union' or 'insert'.
4747
--
48+
-- /Warning/: The size of the map must not exceed @maxBound::Int@. Violation of
49+
-- this condition is not detected and if the size limit is exceeded, its
50+
-- behaviour is undefined.
51+
--
4852
-- Operation comments contain the operation time complexity in
4953
-- the Big-O notation (<http://en.wikipedia.org/wiki/Big_O_notation>).
5054
-----------------------------------------------------------------------------

Data/Map/Lazy.hs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@
4444
-- first argument are always preferred to the second, for example in
4545
-- 'union' or 'insert'.
4646
--
47+
-- /Warning/: The size of the map must not exceed @maxBound::Int@. Violation of
48+
-- this condition is not detected and if the size limit is exceeded, its
49+
-- behaviour is undefined.
50+
--
4751
-- Operation comments contain the operation time complexity in
4852
-- the Big-O notation (<http://en.wikipedia.org/wiki/Big_O_notation>).
4953
-----------------------------------------------------------------------------

Data/Map/Strict.hs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@
4444
-- first argument are always preferred to the second, for example in
4545
-- 'union' or 'insert'.
4646
--
47+
-- /Warning/: The size of the map must not exceed @maxBound::Int@. Violation of
48+
-- this condition is not detected and if the size limit is exceeded, its
49+
-- behaviour is undefined.
50+
--
4751
-- Operation comments contain the operation time complexity in
4852
-- the Big-O notation (<http://en.wikipedia.org/wiki/Big_O_notation>).
4953
--

Data/Sequence.hs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
-- Module : Data.Sequence
1717
-- Copyright : (c) Ross Paterson 2005
1818
-- (c) Louis Wasserman 2009
19-
-- (c) David Feuer, Ross Paterson, and Milan Straka 2014
19+
-- (c) Bertram Felgenhauer, David Feuer, Ross Paterson, and
20+
-- Milan Straka 2014
2021
-- License : BSD-style
2122
-- Maintainer : [email protected]
2223
-- Stability : experimental
@@ -29,7 +30,7 @@
2930
--
3031
-- An amortized running time is given for each operation, with /n/ referring
3132
-- to the length of the sequence and /i/ being the integral index used by
32-
-- some operations. These bounds hold even in a persistent (shared) setting.
33+
-- some operations. These bounds hold even in a persistent (shared) setting.
3334
--
3435
-- The implementation uses 2-3 finger trees annotated with sizes,
3536
-- as described in section 4.2 of
@@ -40,9 +41,16 @@
4041
-- <http://staff.city.ac.uk/~ross/papers/FingerTree.html>
4142
--
4243
-- /Note/: Many of these operations have the same names as similar
43-
-- operations on lists in the "Prelude". The ambiguity may be resolved
44+
-- operations on lists in the "Prelude". The ambiguity may be resolved
4445
-- using either qualification or the @hiding@ clause.
4546
--
47+
-- /Warning/: The size of a 'Seq' must not exceed @maxBound::Int@. Violation
48+
-- of this condition is not detected and if the size limit is exceeded, the
49+
-- behaviour of the sequence is undefined. This is unlikely to occur in most
50+
-- applications, but some care may be required when using '><', '<*>', '*>', or
51+
-- '>>', particularly repeatedly and particularly in combination with
52+
-- 'replicate' or 'fromFunction'.
53+
--
4654
-----------------------------------------------------------------------------
4755

4856
module Data.Sequence (

Data/Set.hs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@
3838
-- 'union' or 'insert'. Of course, left-biasing can only be observed
3939
-- when equality is an equivalence relation instead of structural
4040
-- equality.
41+
--
42+
-- /Warning/: The size of the set must not exceed @maxBound::Int@. Violation of
43+
-- this condition is not detected and if the size limit is exceeded, its
44+
-- behaviour is undefined.
4145
-----------------------------------------------------------------------------
4246

4347
module Data.Set (

Data/Set/Base.hs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@
4545
-- 'union' or 'insert'. Of course, left-biasing can only be observed
4646
-- when equality is an equivalence relation instead of structural
4747
-- equality.
48+
--
49+
-- /Warning/: The size of the set must not exceed @maxBound::Int@. Violation of
50+
-- this condition is not detected and if the size limit is exceeded, its
51+
-- behaviour is undefined.
4852
-----------------------------------------------------------------------------
4953

5054
-- [Note: Using INLINABLE]

0 commit comments

Comments
 (0)