@@ -288,7 +288,17 @@ uncons (Text arr off len)
288288 n = A.unsafeIndex arr (off+1)
289289{-# INLINE uncons #-}
290290
291−-- | /O(n)/ Returns the last character of a 'Text', which must be
291+second :: (b -> c) -> (a,b) -> (a,c)
292+second f (a, b) = (a, f b)
293+
294+{-# RULES
295+"TEXT uncons -> fused" [~1] forall t.
296+ uncons t = fmap (second unstream) (S.uncons (stream t))
297+"TEXT uncons -> unfused" [1] forall t.
298+ fmap (second unstream) (S.uncons (stream t)) = uncons t
299+ #-}
300+
301+-- | /O(1)/ Returns the last character of a 'Text', which must be
292302-- non-empty. Subject to array fusion.
293303last :: Text -> Char
294304last (Text arr off len)