on master help sign in
Mark encoding error functions/types as deprecated (gh-112)
commit364c7c7c7cdb47023fc9869990bd69a72c2d62a6 authorBryan O'Sullivan <bos@serpentine.com> dateWed 29 Apr 2015, 17:57 (11 years ago) parentcb720fe
1 file changed+4
Data/Text/Encoding/Error.hs+4
Data/Text/Encoding/Error.hs+4
@@ -66,6 +66,7 @@ type OnError a b = String -> Maybe a -> Maybe b
6666type OnDecodeError = OnError Word8 Char
6767
6868-- | A handler for an encoding error.
69+{-# DEPRECATED OnEncodeError "This exception is never used in practice, and will be removed." #-}
6970type OnEncodeError = OnError Char Word8
7071
7172-- | An exception type for representing Unicode encoding errors.
@@ -78,6 +79,8 @@ data UnicodeException =
7879 -- under the given encoding, or ran out of input in mid-encode.
7980 deriving (Eq, Typeable)
8081
82+{-# DEPRECATED EncodeError "This constructor is never used, and will be removed." #-}
83+
8184showUnicodeException :: UnicodeException -> String
8285showUnicodeException (DecodeError desc (Just w))
8386 = "Cannot decode byte '\\x" ++ showHex w ("': " ++ desc)
@@ -107,6 +110,7 @@ lenientDecode :: OnDecodeError
107110lenientDecode _ _ = Just '\xfffd'
108111
109112-- | Throw a 'UnicodeException' if encoding fails.
113+{-# DEPRECATED strictEncode "This function always throws an exception, and will be removed." #-}
110114strictEncode :: OnEncodeError
111115strictEncode desc c = throw (EncodeError desc c)
112116