Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix an overly cautious bit of arithmetic checking.

Even though the value behind a Size is an Int, we actually intend that those
values should always be non-negative. (We don't use the notionally more
appropriate Word because GHC doesn't do a very good job with it.)

But non-negative means that 0+0 should be 0! Um, oops.
  • Loading branch information...
commit 99b4a15696793184ff6c853e0b74ce67e868697e 1 parent e1bc8a8
@bos authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  Data/Text/Fusion/Size.hs
View
2  Data/Text/Fusion/Size.hs
@@ -69,7 +69,7 @@ instance Num Size where
{-# INLINE f #-}
add :: Int -> Int -> Int
-add m n | mn > 0 = mn
+add m n | mn >= 0 = mn
| otherwise = overflowError
where mn = m + n
{-# INLINE add #-}

0 comments on commit 99b4a15

Please sign in to comment.
Something went wrong with that request. Please try again.