@@ -254,8 +254,20 @@ import Data.Int (Int64)
254254-- Functions that can be fused by the compiler are marked with the
255255-- phrase \"Subject to fusion\".
256256
257+eq :: Text -> Text -> Bool
258+eq (Text arrA offA lenA) (Text arrB offB lenB)
259+ | lenA /= lenB = False
260+ | otherwise = go 0
261+ where
262+ go !n | n == lenA = True
263+ | a /= b = False
264+ | otherwise = go (n+1)
265+ where a = A.unsafeIndex arrA (offA+n)
266+ b = A.unsafeIndex arrB (offB+n)
267+{-# INLINE eq #-}
268+
257269instance Eq Text where
258− t1 == t2 = stream t1 == stream t2
270+ (==) = eq
259271 {-# INLINE (==) #-}
260272
261273instance Ord Text where