@@ -42,7 +42,7 @@ module Data.Text.Encoding
4242 , encodeUtf32LE
4343 , encodeUtf32BE
4444 ) where
45−
45+
4646import Data.Bits ((.&.))
4747import Data.ByteString as B
4848import Data.ByteString.Internal as B
@@ -110,12 +110,15 @@ decodeUtf8With' onErr bs = textP (fst a) 0 (snd a)
110110 w <- unsafeWrite arr n c
111111 go (n+w) (m+1)
112112 desc = "Data.Text.Encoding.encodeUtf8: Invalid UTF-8 stream"
113−{-# INLINE decodeUtf8With' #-}
113+{-# INLINE[0] decodeUtf8With' #-}
114114
115115-- | Decode a 'ByteString' containing UTF-8 encoded text.
116116decodeUtf8' :: ByteString -> Text
117117decodeUtf8' = decodeUtf8With' strictDecode
118−{-# INLINE decodeUtf8' #-}
118+{-# INLINE[0] decodeUtf8' #-}
119+
120+{-# RULES "STREAM stream/decodeUtf8' fusion" [1]
121+ forall bs. F.stream (decodeUtf8' bs) = E.streamUtf8 strictDecode bs #-}
119122
120123-- | Encode text using UTF-8 encoding.
121124encodeUtf8 :: Text -> ByteString