Commits

Edward Kmett committed 6f568df

simplified compareLengthI with compareSize

  • Participants
  • Parent commits 5f2c2a9

Comments (0)

Files changed (1)

File Data/Text/Internal/Fusion/Common.hs

 -- as the number supplied, and hence be more efficient.
 compareLengthI :: Integral a => Stream Char -> a -> Ordering
 compareLengthI (Stream next s0 len) n =
-    case exactly len of
-      Nothing
-        | upperBound n' len < n' -> LT
-        | lowerBound n' len > n' -> GT
-        | otherwise -> loop_cmp 0 s0
-        where n' = fromIntegral n
-      Just i -> compare (fromIntegral i) n
+    case compareSize len (fromIntegral n) of
+      Just o  -> o
+      Nothing -> loop_cmp 0 s0
     where
       loop_cmp !z s  = case next s of
                          Done       -> compare z n