@@ -319,13 +319,9 @@ lengthI (Stream next s0 _len) = loop_length 0 s0
319319-- as the number supplied, and hence be more efficient.
320320compareLengthI :: Integral a => Stream Char -> a -> Ordering
321321compareLengthI (Stream next s0 len) n =
322− case exactly len of
323− Nothing
324− | upperBound n' len < n' -> LT
325− | lowerBound n' len > n' -> GT
326− | otherwise -> loop_cmp 0 s0
327− where n' = fromIntegral n
328− Just i -> compare (fromIntegral i) n
322+ case compareSize len (fromIntegral n) of
323+ Just o -> o
324+ Nothing -> loop_cmp 0 s0
329325 where
330326 loop_cmp !z s = case next s of
331327 Done -> compare z n