on master help sign in
Mark the ASCII decoding functions as deprecated.
commit9e9d83ee1c989dd900a7ab2902ab892e2468d5d6 authorBryan O'Sullivan <bos@serpentine.com> dateMon 11 Jul 2011, 00:39 (15 years ago) parent73e6399
3 files changed+13−6
Data/Text/Encoding.hs+6−3 Data/Text/Encoding/Fusion.hs+1 Data/Text/Lazy/Encoding.hs+6−3
Data/Text/Encoding.hs+6−3
@@ -82,10 +82,13 @@ import qualified Data.Text.Fusion as F
8282-- 'decodeUtf8With' allows the programmer to determine what to do on a
8383-- decoding error.
8484
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.
8689decodeASCII :: ByteString -> Text
87−decodeASCII bs = F.unstream (E.streamASCII bs)
88−{-# INLINE decodeASCII #-}
90+decodeASCII = decodeUtf8
91+{-# DEPRECATED decodeASCII "Use decodeUtf8 instead" #-}
8992
9093-- | Decode a 'ByteString' containing UTF-8 encoded text.
9194decodeUtf8With :: OnDecodeError -> ByteString -> Text
Data/Text/Encoding/Fusion.hs+1
@@ -61,6 +61,7 @@ streamASCII bs = Stream next 0 (maxSize l)
6161 | otherwise = Yield (unsafeChr8 x1) (i+1)
6262 where
6363 x1 = B.unsafeIndex bs i
64+{-# DEPRECATED streamASCII "Do not use this function" #-}
6465{-# INLINE [0] streamASCII #-}
6566
6667-- | /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
7171-- 'decodeUtf8With' allows the programmer to determine what to do on a
7272-- decoding error.
7373
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.
7578decodeASCII :: B.ByteString -> Text
76−decodeASCII bs = foldr (chunk . TE.decodeASCII) empty (B.toChunks bs)
77−{-# INLINE decodeASCII #-}
79+decodeASCII = decodeUtf8
80+{-# DEPRECATED decodeASCII "Use decodeUtf8 instead" #-}
7881
7982-- | Decode a 'ByteString' containing UTF-8 encoded text.
8083decodeUtf8With :: OnDecodeError -> B.ByteString -> Text