Skip to content

Commit

Permalink
Mark the ASCII decoding functions as deprecated.
Browse files Browse the repository at this point in the history
  • Loading branch information
bos committed Jul 11, 2011
1 parent 73e6399 commit 9e9d83e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
9 changes: 6 additions & 3 deletions Data/Text/Encoding.hs
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions Data/Text/Encoding/Fusion.hs
Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions Data/Text/Lazy/Encoding.hs
Expand Up @@ -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
Expand Down

0 comments on commit 9e9d83e

Please sign in to comment.