- module Data.Encoding.Exception
- module Data.Encoding.ByteSource
- module Data.Encoding.ByteSink
- class Encoding enc where
- decodeChar :: ByteSource m => enc -> m Char
- encodeChar :: ByteSink m => enc -> Char -> m ()
- decode :: ByteSource m => enc -> m String
- encode :: ByteSink m => enc -> String -> m ()
- encodeable :: enc -> Char -> Bool
- data DynEncoding
- recode :: (Encoding enc1, Encoding enc2, ByteSource m, ByteSink m) => enc1 -> enc2 -> m ()
- encodeString :: Encoding enc => enc -> String -> String
- encodeStringExplicit :: Encoding enc => enc -> String -> Either EncodingException String
- decodeString :: Encoding enc => enc -> String -> String
- decodeStringExplicit :: Encoding enc => enc -> String -> Either DecodingException String
- encodeLazyByteString :: Encoding enc => enc -> String -> ByteString
- encodeLazyByteStringExplicit :: Encoding enc => enc -> String -> Either EncodingException ByteString
- decodeLazyByteString :: Encoding enc => enc -> ByteString -> String
- decodeLazyByteStringExplicit :: Encoding enc => enc -> ByteString -> Either DecodingException String
- encodeStrictByteString :: Encoding enc => enc -> String -> ByteString
- encodeStrictByteStringExplicit :: Encoding enc => enc -> String -> Either EncodingException ByteString
- decodeStrictByteString :: Encoding enc => enc -> ByteString -> String
- decodeStrictByteStringExplicit :: Encoding enc => enc -> ByteString -> Either DecodingException String
- encodingFromString :: String -> DynEncoding
- encodingFromStringExplicit :: String -> Maybe DynEncoding
Documentation
module Data.Encoding.Exception
module Data.Encoding.ByteSource
module Data.Encoding.ByteSink
class Encoding enc whereSource
The base class for all encodings. At least decodeChar, encodeChar and encodeable must be implemented.
decodeChar :: ByteSource m => enc -> m CharSource
Read a single character of a ByteSource
encodeChar :: ByteSink m => enc -> Char -> m ()Source
Encode a single character and write it to a ByteSink
decode :: ByteSource m => enc -> m StringSource
Read characters from a ByteSource until it is empty
encode :: ByteSink m => enc -> String -> m ()Source
Encode a String and write it to a ByteSink
encodeable :: enc -> Char -> BoolSource
Tests whether a given character is representable in the Encoding. If this yields True, encodeChar must not fail. If it yields False, encodeChar _must_ throw an exception.
data DynEncoding Source
Wraps all possible encoding types into one data type. Used when a function needs to return an encoding.
encodeString :: Encoding enc => enc -> String -> StringSource
encodeStringExplicit :: Encoding enc => enc -> String -> Either EncodingException StringSource
decodeString :: Encoding enc => enc -> String -> StringSource
decodeStringExplicit :: Encoding enc => enc -> String -> Either DecodingException StringSource
encodeLazyByteString :: Encoding enc => enc -> String -> ByteStringSource
encodeLazyByteStringExplicit :: Encoding enc => enc -> String -> Either EncodingException ByteStringSource
decodeLazyByteString :: Encoding enc => enc -> ByteString -> StringSource
decodeLazyByteStringExplicit :: Encoding enc => enc -> ByteString -> Either DecodingException StringSource
encodeStrictByteString :: Encoding enc => enc -> String -> ByteStringSource
encodeStrictByteStringExplicit :: Encoding enc => enc -> String -> Either EncodingException ByteStringSource
decodeStrictByteString :: Encoding enc => enc -> ByteString -> StringSource
decodeStrictByteStringExplicit :: Encoding enc => enc -> ByteString -> Either DecodingException StringSource
encodingFromString :: String -> DynEncodingSource
Takes the name of an encoding and creates a dynamic encoding from it.
encodingFromStringExplicit :: String -> Maybe DynEncodingSource
Like encodingFromString
but returns Nothing
instead of throwing an error