on master help sign in
Mark the ASCII decoding functions as deprecated.
9e9d83eBryan O'Sullivan
Data/Text/Encoding.hs+6−3
@@ -82,10 +82,13 @@ import qualified Data.Text.Fusion as F
82-- 'decodeUtf8With' allows the programmer to determine what to do on a
82-- 'decodeUtf8With' allows the programmer to determine what to do on a
83-- decoding error.
83-- decoding error.
84
84
85−-- | Decode a 'ByteString' containing 7-bit ASCII encoded text.
85+-- | /Deprecated/. Decode a 'ByteString' containing 7-bit ASCII
86+-- encoded text.
87+--
88+-- This function is deprecated. Use 'decodeUtf8' instead.
86decodeASCII :: ByteString -> Text
89decodeASCII :: ByteString -> Text
87−decodeASCII bs = F.unstream (E.streamASCII bs)
90+decodeASCII = decodeUtf8
88−{-# INLINE decodeASCII #-}
91+{-# DEPRECATED decodeASCII "Use decodeUtf8 instead" #-}
89
92
90-- | Decode a 'ByteString' containing UTF-8 encoded text.
93-- | Decode a 'ByteString' containing UTF-8 encoded text.
91decodeUtf8With :: OnDecodeError -> ByteString -> Text
94decodeUtf8With :: OnDecodeError -> ByteString -> Text
Data/Text/Encoding/Fusion.hs+1
@@ -61,6 +61,7 @@ streamASCII bs = Stream next 0 (maxSize l)
61 | otherwise = Yield (unsafeChr8 x1) (i+1)
61 | otherwise = Yield (unsafeChr8 x1) (i+1)
62 where
62 where
63 x1 = B.unsafeIndex bs i
63 x1 = B.unsafeIndex bs i
64+{-# DEPRECATED streamASCII "Do not use this function" #-}
64{-# INLINE [0] streamASCII #-}
65{-# INLINE [0] streamASCII #-}
65
66
66-- | /O(n)/ Convert a 'ByteString' into a 'Stream Char', using UTF-8
67-- | /O(n)/ Convert a 'ByteString' into a 'Stream Char', using UTF-8
Data/Text/Lazy/Encoding.hs+6−3
@@ -71,10 +71,13 @@ import qualified Data.Text.Lazy.Fusion as F
71-- 'decodeUtf8With' allows the programmer to determine what to do on a
71-- 'decodeUtf8With' allows the programmer to determine what to do on a
72-- decoding error.
72-- decoding error.
73
73
74−-- | Decode a 'ByteString' containing 7-bit ASCII encoded text.
74+-- | /Deprecated/. Decode a 'ByteString' containing 7-bit ASCII
75+-- encoded text.
76+--
77+-- This function is deprecated. Use 'decodeUtf8' instead.
75decodeASCII :: B.ByteString -> Text
78decodeASCII :: B.ByteString -> Text
76−decodeASCII bs = foldr (chunk . TE.decodeASCII) empty (B.toChunks bs)
79+decodeASCII = decodeUtf8
77−{-# INLINE decodeASCII #-}
80+{-# DEPRECATED decodeASCII "Use decodeUtf8 instead" #-}
78
81
79-- | Decode a 'ByteString' containing UTF-8 encoded text.
82-- | Decode a 'ByteString' containing UTF-8 encoded text.
80decodeUtf8With :: OnDecodeError -> B.ByteString -> Text
83decodeUtf8With :: OnDecodeError -> B.ByteString -> Text