@@ -581,7 +581,12 @@ dropWhile p t = unstream (S.dropWhile p (stream t))
581581-- | /O(n)/ Return all initial segments of the given 'Text', shortest
582582-- first.
583583inits :: Text -> [Text]
584−inits (Text arr off len) = [Text arr off l | l <- [0..len]]
584+inits t@(Text arr off len) = loop off
585+ where loop i | i >= len = [t]
586+ | otherwise = Text arr off i : loop j
587+ where j | n < 0xDC00 || n > 0xDFFF = i + 1
588+ | otherwise = i + 2
589+ n = A.unsafeIndex arr i
585590
586591-- | /O(n)/ Return all final segments of the given 'Text', longest
587592-- first.