Safe Haskell | None |
---|---|
Language | Haskell98 |
- module Data.Encoding.Exception
- module Data.Encoding.ByteSource
- module Data.Encoding.ByteSink
- class Encoding enc where
- 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 where Source #
The base class for all encodings. At least decodeChar, encodeChar and encodeable must be implemented.
decodeChar :: ByteSource m => enc -> m Char Source #
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 String Source #
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 -> Bool Source #
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.
encodeStringExplicit :: Encoding enc => enc -> String -> Either EncodingException String Source #
decodeStringExplicit :: Encoding enc => enc -> String -> Either DecodingException String Source #
encodeLazyByteString :: Encoding enc => enc -> String -> ByteString Source #
encodeLazyByteStringExplicit :: Encoding enc => enc -> String -> Either EncodingException ByteString Source #
decodeLazyByteString :: Encoding enc => enc -> ByteString -> String Source #
decodeLazyByteStringExplicit :: Encoding enc => enc -> ByteString -> Either DecodingException String Source #
encodeStrictByteString :: Encoding enc => enc -> String -> ByteString Source #
encodeStrictByteStringExplicit :: Encoding enc => enc -> String -> Either EncodingException ByteString Source #
decodeStrictByteString :: Encoding enc => enc -> ByteString -> String Source #
decodeStrictByteStringExplicit :: Encoding enc => enc -> ByteString -> Either DecodingException String Source #
encodingFromString :: String -> DynEncoding Source #
Takes the name of an encoding and creates a dynamic encoding from it.
encodingFromStringExplicit :: String -> Maybe DynEncoding Source #
Like encodingFromString
but returns Nothing
instead of throwing an error