on master help sign in
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.

commit99b4a15696793184ff6c853e0b74ce67e868697e authorBryan O'Sullivan <bos@serpentine.com> dateWed 20 Jul 2011, 11:32 (15 years ago) parente1bc8a8
1 file changed+1−1
Data/Text/Fusion/Size.hs+1−1
Data/Text/Fusion/Size.hs+1−1
@@ -69,7 +69,7 @@ instance Num Size where
6969 {-# INLINE f #-}
7070
7171add :: Int -> Int -> Int
72−add m n | mn > 0 = mn
72+add m n | mn >= 0 = mn
7373 | otherwise = overflowError
7474 where mn = m + n
7575{-# INLINE add #-}