diff --git a/Data/Text/Encoding.hs b/Data/Text/Encoding.hs index 4363afba..2e85e901 100644 --- a/Data/Text/Encoding.hs +++ b/Data/Text/Encoding.hs @@ -82,10 +82,13 @@ import qualified Data.Text.Fusion as F -- 'decodeUtf8With' allows the programmer to determine what to do on a -- decoding error. --- | Decode a 'ByteString' containing 7-bit ASCII encoded text. +-- | /Deprecated/. Decode a 'ByteString' containing 7-bit ASCII +-- encoded text. +-- +-- This function is deprecated. Use 'decodeUtf8' instead. decodeASCII :: ByteString -> Text -decodeASCII bs = F.unstream (E.streamASCII bs) -{-# INLINE decodeASCII #-} +decodeASCII = decodeUtf8 +{-# DEPRECATED decodeASCII "Use decodeUtf8 instead" #-} -- | Decode a 'ByteString' containing UTF-8 encoded text. decodeUtf8With :: OnDecodeError -> ByteString -> Text diff --git a/Data/Text/Encoding/Fusion.hs b/Data/Text/Encoding/Fusion.hs index dfcffcd8..ee580507 100644 --- a/Data/Text/Encoding/Fusion.hs +++ b/Data/Text/Encoding/Fusion.hs @@ -61,6 +61,7 @@ streamASCII bs = Stream next 0 (maxSize l) | otherwise = Yield (unsafeChr8 x1) (i+1) where x1 = B.unsafeIndex bs i +{-# DEPRECATED streamASCII "Do not use this function" #-} {-# INLINE [0] streamASCII #-} -- | /O(n)/ Convert a 'ByteString' into a 'Stream Char', using UTF-8 diff --git a/Data/Text/Lazy/Encoding.hs b/Data/Text/Lazy/Encoding.hs index a98e91cb..2b361acc 100644 --- a/Data/Text/Lazy/Encoding.hs +++ b/Data/Text/Lazy/Encoding.hs @@ -71,10 +71,13 @@ import qualified Data.Text.Lazy.Fusion as F -- 'decodeUtf8With' allows the programmer to determine what to do on a -- decoding error. --- | Decode a 'ByteString' containing 7-bit ASCII encoded text. +-- | /Deprecated/. Decode a 'ByteString' containing 7-bit ASCII +-- encoded text. +-- +-- This function is deprecated. Use 'decodeUtf8' instead. decodeASCII :: B.ByteString -> Text -decodeASCII bs = foldr (chunk . TE.decodeASCII) empty (B.toChunks bs) -{-# INLINE decodeASCII #-} +decodeASCII = decodeUtf8 +{-# DEPRECATED decodeASCII "Use decodeUtf8 instead" #-} -- | Decode a 'ByteString' containing UTF-8 encoded text. decodeUtf8With :: OnDecodeError -> B.ByteString -> Text