Permalink
Browse files

Mark the ASCII decoding functions as deprecated.

  • Loading branch information...
bos committed Jul 11, 2011
1 parent 73e6399 commit 9e9d83ee1c989dd900a7ab2902ab892e2468d5d6
Showing with 13 additions and 6 deletions.
  1. +6 −3 Data/Text/Encoding.hs
  2. +1 −0 Data/Text/Encoding/Fusion.hs
  3. +6 −3 Data/Text/Lazy/Encoding.hs
View
@@ -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
@@ -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
@@ -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

0 comments on commit 9e9d83e

Please sign in to comment.