@@ -254,8 +254,15 @@ null t = S.null (stream t)
254254-- | /O(n)/ Returns the number of characters in a text.
255255-- Subject to array fusion.
256256length :: Text -> Int
257−length t = S.length (stream t)
258−{-# INLINE length #-}
257+length (Text _arr _off len) = len
258+{-# INLINE [1] length #-}
259+
260+{-# RULES
261+"TEXT length -> fused" [~1] forall t.
262+ length t = S.length (stream t)
263+"TEXT length -> unfused" [1] forall t.
264+ S.length (stream t) = length t
265+ #-}
259266
260267-- -----------------------------------------------------------------------------
261268-- * Transformations