on master help sign in
Remove old UTF-8 encoding functions
8136562Bryan O'Sullivan
Data/Text/Encoding.hs−6
@@ -35,7 +35,6 @@ module Data.Text.Encoding
35
35
36 -- * Encoding Text to ByteStrings
36 -- * Encoding Text to ByteStrings
37 , encodeUtf8
37 , encodeUtf8
38− , encodeUtf8'
39 , encodeUtf16LE
38 , encodeUtf16LE
40 , encodeUtf16BE
39 , encodeUtf16BE
41 , encodeUtf32LE
40 , encodeUtf32LE
@@ -74,11 +73,6 @@ decodeUtf8 :: ByteString -> Text
74decodeUtf8 = decodeUtf8With strictDecode
73decodeUtf8 = decodeUtf8With strictDecode
75{-# INLINE decodeUtf8 #-}
74{-# INLINE decodeUtf8 #-}
76
75
77−-- | Encode text using UTF-8 encoding.
78−encodeUtf8' :: Text -> ByteString
79−encodeUtf8' txt = E.unstream (E.restreamUtf8 (F.stream txt))
80−{-# INLINE encodeUtf8' #-}
81−
82-- | Encode text using UTF-8 encoding.
76-- | Encode text using UTF-8 encoding.
83encodeUtf8 :: Text -> ByteString
77encodeUtf8 :: Text -> ByteString
84encodeUtf8 (Text arr off len) = unsafePerformIO $ do
78encodeUtf8 (Text arr off len) = unsafePerformIO $ do
Data/Text/Lazy/Encoding.hs−6
@@ -32,7 +32,6 @@ module Data.Text.Lazy.Encoding
32
32
33 -- * Encoding Text to ByteStrings
33 -- * Encoding Text to ByteStrings
34 , encodeUtf8
34 , encodeUtf8
35− , encodeUtf8'
36 , encodeUtf16LE
35 , encodeUtf16LE
37 , encodeUtf16BE
36 , encodeUtf16BE
38 , encodeUtf32LE
37 , encodeUtf32LE
@@ -62,11 +61,6 @@ decodeUtf8 :: B.ByteString -> Text
62decodeUtf8 = decodeUtf8With strictDecode
61decodeUtf8 = decodeUtf8With strictDecode
63{-# INLINE decodeUtf8 #-}
62{-# INLINE decodeUtf8 #-}
64
63
65−-- | Encode text using UTF-8 encoding.
66−encodeUtf8' :: Text -> B.ByteString
67−encodeUtf8' txt = E.unstream (E.restreamUtf8 (F.stream txt))
68−{-# INLINE encodeUtf8' #-}
69−
70encodeUtf8 :: Text -> B.ByteString
64encodeUtf8 :: Text -> B.ByteString
71encodeUtf8 (Chunk c cs) = B.Chunk (TE.encodeUtf8 c) (encodeUtf8 cs)
65encodeUtf8 (Chunk c cs) = B.Chunk (TE.encodeUtf8 c) (encodeUtf8 cs)
72encodeUtf8 Empty = B.Empty
66encodeUtf8 Empty = B.Empty
tests/benchmarks/EncodeUtf8.hs−10
@@ -19,14 +19,6 @@ lazy_bytestring k s = do
19 let t = TL.replicate (fromIntegral k) (TL.pack s)
19 let t = TL.replicate (fromIntegral k) (TL.pack s)
20 BL.putStr (TL.encodeUtf8 t)
20 BL.putStr (TL.encodeUtf8 t)
21
21
22−strict_bytestring_ k s = do
23− let t = T.replicate k (T.pack s)
24− B.putStr (T.encodeUtf8' t)
25−
26−lazy_bytestring_ k s = do
27− let t = TL.replicate (fromIntegral k) (TL.pack s)
28− BL.putStr (TL.encodeUtf8' t)
29−
30strict_io k s = do
22strict_io k s = do
31 let t = T.replicate k (T.pack s)
23 let t = T.replicate k (T.pack s)
32 hSetEncoding stdout utf8
24 hSetEncoding stdout utf8
@@ -56,8 +48,6 @@ main = do
56 case kind of
48 case kind of
57 "strict" -> strict_bytestring k str
49 "strict" -> strict_bytestring k str
58 "lazy" -> lazy_bytestring k str
50 "lazy" -> lazy_bytestring k str
59− "strict_" -> strict_bytestring_ k str
60− "lazy_" -> lazy_bytestring_ k str
61 "strict_io" -> strict_io k str
51 "strict_io" -> strict_io k str
62 "lazy_io" -> lazy_io k str
52 "lazy_io" -> lazy_io k str
63 "string" -> string k str
53 "string" -> string k str