Skip to content

Commit 76a4999

Browse files
committed
Fusion.Size: Assert that n >= 0
1 parent acfdb6a commit 76a4999

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Data/Text/Internal/Fusion/Size.hs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,11 @@ charSize c
6161

6262
-- | The 'Size' of @n@ code points.
6363
codePointsSize :: Int -> Size
64-
codePointsSize n = Between n (2*n)
64+
codePointsSize n =
65+
#if defined(ASSERTS)
66+
assert (n >= 0)
67+
#endif
68+
Between n (2*n)
6569
{-# INLINE codePointsSize #-}
6670

6771
exactSize :: Int -> Size

0 commit comments

Comments
 (0)