Commits

Bryan O'Sullivan committed 83171b7

Get rid of old lazy UTF-8 function

  • Participants
  • Parent commits 54ee4c2

Comments (0)

Files changed (2)

Data/Text/Lazy/Encoding.hs

     -- * Decoding ByteStrings to Text
       decodeASCII
     , decodeUtf8
-    , decodeUtf8'
     , decodeUtf16LE
     , decodeUtf16BE
     , decodeUtf32LE
     , decodeUtf32BE
     -- ** Controllable error handling
     , decodeUtf8With
-    , decodeUtf8With'
     , decodeUtf16LEWith
     , decodeUtf16BEWith
     , decodeUtf32LEWith
 
 -- | Decode a 'ByteString' containing UTF-8 encoded text.
 decodeUtf8With :: OnDecodeError -> B.ByteString -> Text
-decodeUtf8With onErr bs = F.unstream (E.streamUtf8 onErr bs)
-{-# INLINE decodeUtf8With #-}
-
--- | Decode a 'ByteString' containing UTF-8 encoded text.
-decodeUtf8 :: B.ByteString -> Text
-decodeUtf8 = decodeUtf8With strictDecode
-{-# INLINE decodeUtf8 #-}
-
--- | Decode a 'ByteString' containing UTF-8 encoded text.
-decodeUtf8With' :: OnDecodeError -> B.ByteString -> Text
-decodeUtf8With' onErr bs0 = fast bs0
+decodeUtf8With onErr bs0 = fast bs0
   where
     decode = TE.decodeUtf8With onErr
     fast (B.Chunk p ps) | isComplete p = chunk (decode p) (fast ps)
       where len = S.length bs
             ix n = S.unsafeIndex bs (len-n)
     desc = "Data.Text.Lazy.Encoding.decodeUtf8With: Invalid UTF-8 stream"
-{-# INLINE[0] decodeUtf8With' #-}
+{-# INLINE[0] decodeUtf8With #-}
 
 -- | Decode a 'ByteString' containing UTF-8 encoded text.
-decodeUtf8' :: B.ByteString -> Text
-decodeUtf8' = decodeUtf8With' strictDecode
-{-# INLINE[0] decodeUtf8' #-}
+decodeUtf8 :: B.ByteString -> Text
+decodeUtf8 = decodeUtf8With strictDecode
+{-# INLINE[0] decodeUtf8 #-}
 
 -- This rule seems to cause performance loss.
 {- RULES "LAZY STREAM stream/decodeUtf8' fusion" [1]

tests/benchmarks/DecodeUtf8.hs

   bs <- BL.hGetContents h
   rnf (TL.decodeUtf8 bs) `seq` return ()
 
-lazy_ h = do
-  bs <- BL.hGetContents h
-  rnf (TL.decodeUtf8' bs) `seq` return ()
-
 lazy_len h = do
   bs <- BL.hGetContents h
   print . TL.length . TL.decodeUtf8 $ bs
 
-lazy__len h = do
-  bs <- BL.hGetContents h
-  print . TL.length . TL.decodeUtf8' $ bs
-
 lazy_init_len h = do
   bs <- BL.hGetContents h
   print . TL.length . TL.init . TL.decodeUtf8 $ bs
 
-lazy__init_len h = do
-  bs <- BL.hGetContents h
-  print . TL.length . TL.init . TL.decodeUtf8' $ bs
-
 lazy_io h = do
   hSetEncoding h utf8
   t <- TL.hGetContents h
     "lazy" -> lazy h
     "lazy_len" -> lazy_len h
     "lazy_init_len" -> lazy_init_len h
-    "lazy__init_len" -> lazy__init_len h
-    "lazy_" -> lazy_ h
-    "lazy__len" -> lazy__len h
     "lazy_io" -> lazy_io h
     "lazy_len_io" -> lazy_len_io h
     "string" -> string h